Skip to content

Commit f1225f0

Browse files
committed
Don't reexecute live queries
1 parent aa596f7 commit f1225f0

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

packages/api-client-core/src/GadgetConnection.ts

+12
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,18 @@ export class GadgetConnection {
441441
requestPolicy: this.requestPolicy,
442442
});
443443
(client as any)[$gadgetConnection] = this;
444+
445+
const reexecuteOperation = client.reexecuteOperation.bind(client);
446+
client.reexecuteOperation = (operation) => {
447+
if (operation.query.definitions.some(isLiveQueryOperationDefinitionNode)) {
448+
// live queries don't cleanup properly when reexecuted, plus
449+
// they should never need to be reexecuted since they receive
450+
// updates from the server, so we noop here
451+
return;
452+
}
453+
reexecuteOperation(operation);
454+
};
455+
444456
return client;
445457
}
446458

0 commit comments

Comments
 (0)