Skip to content

Commit

Permalink
fix: lost synchronization after socket reconnection
Browse files Browse the repository at this point in the history
  • Loading branch information
tea-artist committed Sep 4, 2024
1 parent f0c9bd8 commit 6b26ecc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/sdk/src/context/use-instances/opListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class OpListenersManager<T> {

add(doc: Doc<T>, handler: (op: unknown[]) => void) {
if (this.opListeners.has(doc.id)) {
this.remove(doc);
return;
}
doc.on('op batch', handler);
this.opListeners.set(doc.id, () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/src/context/use-instances/useInstances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const queryDestroy = (query: Query | undefined, cb?: () => void) => {
query.once('ready', () => {
query.destroy(() => {
query.removeAllListeners();
query.results?.forEach((doc) => doc.listenerCount('op') === 0 && doc.destroy());
query.results?.forEach((doc) => doc.listenerCount('op batch') === 0 && doc.destroy());
cb?.();
});
});
Expand Down

0 comments on commit 6b26ecc

Please sign in to comment.