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