Address review: only register panes while the tuner is open

camUpdate registered every pane each frame regardless of whether the tuner
had ever been opened, so window.__h3dAspectPanes could grow unbounded (prune
runs only while the panel is open) and it ran even for users who never opt
in. Gate _aspectRegisterPane behind __h3dAspectPanelOpen (same gate as the
readout). The pane key is still resolved every frame so saved overrides keep
applying; only the picker bookkeeping is deferred until the panel is open.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: topkoa <topkoa@gmail.com>
This commit is contained in:
topkoa
2026-07-01 02:54:15 -04:00
co-authored by Claude Opus 4.8
parent 24d24ef2cf
commit 1434eb6342
2 changed files with 7 additions and 3 deletions
+5 -1
View File
@@ -14459,7 +14459,11 @@
// costs nothing. // costs nothing.
const _paneKey = _aspectPaneKey( const _paneKey = _aspectPaneKey(
bundle && bundle.songInfo && bundle.songInfo.arrangement, _paneUid); bundle && bundle.songInfo && bundle.songInfo.arrangement, _paneUid);
_aspectRegisterPane(_paneKey); // Only feed the Target-picker registry while the tuner is open (same
// gate as the readout). Closed → nothing is registered, so the registry
// can't grow for users who never open the panel; the key is still
// resolved below so any saved overrides keep applying.
if (window.__h3dAspectPanelOpen) _aspectRegisterPane(_paneKey);
const _aspTune = _resolveTuneFor(_paneKey); const _aspTune = _resolveTuneFor(_paneKey);
const _aspActive = !!(_aspTune && _aspTune.enabled const _aspActive = !!(_aspTune && _aspTune.enabled
&& !(_aspTune.splitOnly && !_ssActive())); && !(_aspTune.splitOnly && !_ssActive()));
+2 -2
View File
@@ -170,8 +170,8 @@ test('a Target select and pane registry drive the per-pane picker', () => {
'the panel must build a Target <select>'); 'the panel must build a Target <select>');
assert.match(src, /function\s+_aspectRegisterPane\s*\(/, assert.match(src, /function\s+_aspectRegisterPane\s*\(/,
'_aspectRegisterPane must record live panes for the picker'); '_aspectRegisterPane must record live panes for the picker');
assert.match(src, /_aspectRegisterPane\(\s*_paneKey\s*\)/, assert.match(src, /if\s*\(\s*window\.__h3dAspectPanelOpen\s*\)\s*_aspectRegisterPane\(\s*_paneKey\s*\)/,
'camUpdate must register its pane each frame'); 'camUpdate must register its pane only while the tuner panel is open');
}); });
test('panes are keyed by arrangement (stable across songs, no split-API dep)', () => { test('panes are keyed by arrangement (stable across songs, no split-API dep)', () => {