Skip to content

Commit f027d09

Browse files
refactor: cleanupOrphanedPanels calls
- add cleanUpOrphanedPanels() to initialization - add cleanupOrphanedPanels() to closeAllPanels()
1 parent c8e67f1 commit f027d09

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/core/ExtensionManager.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ class ExtensionManager {
2626
return false; // Don't keep channel open
2727
});
2828
}
29-
29+
3030
await this.loadCoreCSS();
31-
31+
32+
this.cleanupOrphanedPanels();
33+
3234
this.initialized = true;
3335
}
3436

@@ -95,8 +97,8 @@ class ExtensionManager {
9597
}
9698

9799
cleanupOrphanedPanels() {
98-
// Remove any orphaned panels from DOM
99-
const orphanedPanels = this.panels.get('.cv-panel');
100+
// Remove any orphaned panels from DOM that aren't tracked in our map
101+
const orphanedPanels = document.querySelectorAll('.cv-panel');
100102
orphanedPanels.forEach(panel => {
101103
panel.remove();
102104
});
@@ -140,13 +142,12 @@ class ExtensionManager {
140142
panel.hideImmediate();
141143
}
142144
}
145+
146+
// Clear the panels map
143147
this.panels.clear();
144148

145149
// Also remove any orphaned panels from DOM
146-
const existingPanels = this.panels.get('.cv-panel');
147-
existingPanels.forEach(panel => {
148-
panel.remove();
149-
});
150+
this.cleanupOrphanedPanels();
150151
}
151152

152153
// TODO: Assessment workflow methods will be added later

0 commit comments

Comments
 (0)