mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-21 00:07:01 +08:00
feat(core): awareness change event instead of update event (#10649)
This commit is contained in:
@@ -40,7 +40,7 @@ export class AwarenessFrontend {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
awareness.on('update', handleAwarenessUpdate);
|
awareness.on('change', handleAwarenessUpdate);
|
||||||
const handleSyncUpdate = (update: AwarenessRecord, origin?: string) => {
|
const handleSyncUpdate = (update: AwarenessRecord, origin?: string) => {
|
||||||
if (origin === uniqueId) {
|
if (origin === uniqueId) {
|
||||||
// skip self update
|
// skip self update
|
||||||
@@ -62,12 +62,12 @@ export class AwarenessFrontend {
|
|||||||
);
|
);
|
||||||
|
|
||||||
awareness.once('destroy', () => {
|
awareness.once('destroy', () => {
|
||||||
awareness.off('update', handleAwarenessUpdate);
|
awareness.off('change', handleAwarenessUpdate);
|
||||||
unsubscribe();
|
unsubscribe();
|
||||||
});
|
});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
awareness.off('update', handleAwarenessUpdate);
|
awareness.off('change', handleAwarenessUpdate);
|
||||||
unsubscribe();
|
unsubscribe();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user