Repository navigation
fix(tray): stop auto-fit ResizeObserver feedback loop - #352
Conversation
|
Hey, thanks for the PR, I will review this ASAP. |
Thermo-Nuclear Code Quality Review — APPROVEVerdictMinimal, correct fix at the right site using existing state. No structural debt added. Findings1. Structural regressions — None. The 6-line guard reuses two refs that were already tracking exactly the right state: The guard's invariant is clean:
2. Missed code-judo — None. The fix is the minimal correct change at the right site. The 186-line auto-fit function is pre-existing and untouched. 3. Spaghetti / branching — None. Clean early-return at the top of the callback answering "is this my own echo?" — not a special case bolted into an unrelated flow. 4. Type/boundary — Clean. No new types, casts, or optional churn. The 200ms trailing delay on 5. File-size — No concern. Hook: 393→405 (+13). Test: 6. Test quality — Good. 7. Legibility — Clear. Comment explains the why. Guard reads naturally. Test name matches behavior. ApprovalNo structural regression, no missed simplification, no file-size explosion, no spaghetti growth, no hacky abstraction. Approve. |
Summary
ResizeObserver.mainbefore the hook fix and settles after it.The auto-fit pass temporarily removes height and overflow constraints to measure the full surface. On the affected Windows/WebView2 setup, the observer saw those programmatic changes and re-entered auto-fit indefinitely, making the Pop Out Dashboard alternate between measured and committed layouts. This is a separate feedback path from the fractional-DPI native-size cycle handled in #272.
Related issue
Follow-up to #261 and #272.
Affected areas
Validation
powershell.exe -ExecutionPolicy Bypass -NoProfile -File scripts\local-check.ps13reveal calls instead of settled2) and all 3 sizing tests pass afterwardpnpm --dir apps\desktop-tauri run tauri:build:debugUI / tray proof
CUA Driver is not installed on the test machine (
%LOCALAPPDATA%\Programs\Cua\cua-driver\bin\cua-driver.exeis absent), so I used equivalent native Windows/WebView2 proof against a fresh debug build from this branch:ResizeObservercallback328 x 920For comparison, the affected build produced roughly 160 body/surface height transitions and about 240 observer callbacks in 12 seconds, plus 37 one-frame visual pulses in 12.6 seconds.
Notes for reviewers
The
layoutReadyRef.currentguard is intentional: observer callbacks remain active during first-open convergence, then callbacks caused by the hook's own measurement pass are ignored whileprogrammaticInFlightRefis active. This preserves initial auto-fit and avoids misclassifying the hidden window's tiny bootstrap frame as a user-resized size.The diff is limited to
useTrayPanelLayout.tsand its sizing test; it contains no Rust/backend or local process-discovery changes.