fix: stop Cockpit work before asynchronous UI teardown

This commit is contained in:
Sameh Khamis committed 2026-09-13 02:46:57 -07:00
1 parent 947fc79182
commit 152d3e2352
11 files changed
+150 -15

No files matched your search

+10 -2
View File
@@ -63,6 +63,7 @@ export class CockpitViewController {
this.viewer = viewer;
this.services = services;
this.destroyed = false;
this.disposed = false;
this.active = false;
this.trackedEntity = null;
this.trackedEntityWasShown = true;
@@ -407,10 +408,10 @@ export class CockpitViewController {
return handleSignalClick.call(this, event);
}
dispose() {
/** Revoke new work before the shell awaits layer restoration. */
stop() {
if (this.destroyed) return;
this.destroyed = true;
this.exit({ restoreTracking: false });
this.regionalBriefAbort?.abort();
this.regionalBriefAbort = null;
this.regionalBriefRequestToken += 1;
@@ -421,4 +422,11 @@ export class CockpitViewController {
for (const removeListener of this._listenerRemovers.splice(0))
removeListener?.();
}
dispose() {
if (this.disposed) return;
this.disposed = true;
this.stop();
this.exit({ restoreTracking: false });
}
}