Skip to content

fix(tray): stop auto-fit ResizeObserver feedback loop - #352

Open
MiguelMachado-dev wants to merge 1 commit into
nesszer:mainfrom
MiguelMachado-dev:fix/tray-autofit-observer-feedback
Open

fix(tray): stop auto-fit ResizeObserver feedback loop#352
MiguelMachado-dev wants to merge 1 commit into
nesszer:mainfrom
MiguelMachado-dev:fix/tray-autofit-observer-feedback

Conversation

@MiguelMachado-dev

Copy link
Copy Markdown

Summary

  • Stop auto-fit measurement style changes from recursively scheduling another layout pass through the tray surface's ResizeObserver.
  • Keep observer-driven sizing enabled until the initial layout converges, so a newly created flyout still reaches its normal size.
  • Add a deterministic style-feedback regression test that fails on main before 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

  • Tray panel
  • Settings UI
  • Config file / settings persistence
  • CLI
  • Provider-specific behavior
  • Installer / release packaging
  • Startup / background behavior
  • Documentation
  • Other: detached Pop Out Dashboard flyout

Validation

  • powershell.exe -ExecutionPolicy Bypass -NoProfile -File scripts\local-check.ps1
    • Shared Rust: 1,293 tests passed
    • Tauri Rust: 353 tests passed
    • Frontend: 44 files / 269 tests passed
    • Frontend TypeScript/Vite build passed
    • Formatting and clippy gates passed
  • Full pre-release validation: not applicable; no packaging or release changes
  • Installer/release validation: not applicable
  • Thermo-nuclear code quality review completed before submitting
  • Focused red/green test: the new test fails before the hook change (3 reveal calls instead of settled 2) and all 3 sizing tests pass afterward
  • Fresh Windows debug build: pnpm --dir apps\desktop-tauri run tauri:build:debug

UI / tray proof

  • Not applicable
  • CUA Driver visual proof attached
  • CUA Driver could not be used; equivalent manual proof and explanation attached

CUA Driver is not installed on the test machine (%LOCALAPPDATA%\Programs\Cua\cua-driver\bin\cua-driver.exe is absent), so I used equivalent native Windows/WebView2 proof against a fresh debug build from this branch:

  • 12-second CDP sample, 2,160 animation frames: 0 body, surface, max-height, or native inner-height transitions; 1 ResizeObserver callback
  • 14-second desktop capture, 180 frames: 1 unique frame, 0 frame transitions, 0 single-frame flicker pulses, 1 native window geometry
  • Flyout remained 328 x 920
  • No bogus tiny remembered flyout size was persisted

For 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.current guard is intentional: observer callbacks remain active during first-open convergence, then callbacks caused by the hook's own measurement pass are ignored while programmaticInFlightRef is 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.ts and its sizing test; it contains no Rust/backend or local process-discovery changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant