Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

feat(core): awareness change event instead of update event (#10649)

EYHNeaaf4bebef91
diff --git a/packages/common/nbstore/src/frontend/awareness.ts b/packages/common/nbstore/src/frontend/awareness.ts
index e75515420f..66cfbe2db3 100644
--- a/packages/common/nbstore/src/frontend/awareness.ts
+++ b/packages/common/nbstore/src/frontend/awareness.ts
@@ -40,7 +40,7 @@ export class AwarenessFrontend {
});
};
- awareness.on('update', handleAwarenessUpdate);
+ awareness.on('change', handleAwarenessUpdate);
const handleSyncUpdate = (update: AwarenessRecord, origin?: string) => {
if (origin === uniqueId) {
// skip self update
@@ -62,12 +62,12 @@ export class AwarenessFrontend {
);
awareness.once('destroy', () => {
- awareness.off('update', handleAwarenessUpdate);
+ awareness.off('change', handleAwarenessUpdate);
unsubscribe();
});
return () => {
- awareness.off('update', handleAwarenessUpdate);
+ awareness.off('change', handleAwarenessUpdate);
unsubscribe();
};
}