Skip to content

Commit 91dcebc

Browse files
committed
fix(panels): guard removeEventListener against null _onResizeDebounced
Dropping the ?? this.ensureCorrectZones fallback in f9d6ed4 passed _onResizeDebounced (which can be null) directly to removeEventListener. That broke typecheck (TS2769) because removeEventListener does not accept null. Guard both calls with an if so the listener is only removed when we actually have one registered. destroy() keeps the optional-chained cancel() + null assignment to satisfy the source-level wiring test. Verified: typecheck clean, 12/12 tests pass.
1 parent 7413429 commit 91dcebc

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/app/panel-layout.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,9 @@ export class PanelLayoutManager implements AppModule {
417417
// Reset checkout overlay so next layout init can register its callback
418418
destroyCheckoutOverlay();
419419

420-
window.removeEventListener('resize', this._onResizeDebounced);
420+
if (this._onResizeDebounced) {
421+
window.removeEventListener('resize', this._onResizeDebounced);
422+
}
421423
this._onResizeDebounced?.cancel();
422424
this._onResizeDebounced = null;
423425
}
@@ -1688,8 +1690,10 @@ export class PanelLayoutManager implements AppModule {
16881690
});
16891691
}
16901692

1691-
window.removeEventListener('resize', this._onResizeDebounced);
1692-
this._onResizeDebounced?.cancel();
1693+
if (this._onResizeDebounced) {
1694+
window.removeEventListener('resize', this._onResizeDebounced);
1695+
this._onResizeDebounced.cancel();
1696+
}
16931697
this._onResizeDebounced = debounce(() => this.ensureCorrectZones(), 100);
16941698
window.addEventListener('resize', this._onResizeDebounced);
16951699

0 commit comments

Comments
 (0)