mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
fix(editor): invoke subscriber.unsubscribe() during cleanup (#12628)
This commit is contained in:
@@ -132,12 +132,13 @@ export class DocEngine {
|
||||
this.logger
|
||||
);
|
||||
|
||||
cleanUp.push(
|
||||
state.mainPeer.onStatusChange.subscribe(() => {
|
||||
if (!signal.aborted)
|
||||
this.updateSyncingState(state.mainPeer, state.shadowPeers);
|
||||
}).unsubscribe
|
||||
);
|
||||
const subscriber = state.mainPeer.onStatusChange.subscribe(() => {
|
||||
if (!signal.aborted)
|
||||
this.updateSyncingState(state.mainPeer, state.shadowPeers);
|
||||
});
|
||||
cleanUp.push(() => {
|
||||
subscriber.unsubscribe();
|
||||
});
|
||||
|
||||
this.updateSyncingState(state.mainPeer, state.shadowPeers);
|
||||
|
||||
@@ -152,12 +153,15 @@ export class DocEngine {
|
||||
this.priorityTarget,
|
||||
this.logger
|
||||
);
|
||||
cleanUp.push(
|
||||
peer.onStatusChange.subscribe(() => {
|
||||
if (!signal.aborted)
|
||||
this.updateSyncingState(state.mainPeer, state.shadowPeers);
|
||||
}).unsubscribe
|
||||
);
|
||||
|
||||
const subscriber = peer.onStatusChange.subscribe(() => {
|
||||
if (!signal.aborted)
|
||||
this.updateSyncingState(state.mainPeer, state.shadowPeers);
|
||||
});
|
||||
cleanUp.push(() => {
|
||||
subscriber.unsubscribe();
|
||||
});
|
||||
|
||||
return peer;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user