fix(web): stop paneOverlay ref-count effect self-looping on mobile (BUG-2284)#1009
Merged
Conversation
…UG-2284) PR #1007 (TASK-2131) added a PaneHost `$effect` that calls `paneOverlay.enter()`/`leave()` to inert the app-shell chrome behind the mobile detail-pane overlay. `enter()`'s `overlayCount += 1` READS `overlayCount` inside that tracked effect scope, so the effect took a reactive dependency on the very signal it writes: enter() dirtied the effect → it re-ran → enter()d again → `effect_update_depth_exceeded`. Svelte aborts the flush, stranding the rest of the subtree's reactivity — `paneMintForRoute` stopped recomputing, so the mobile pane (and its Back chevron) rendered EMPTY. The E2E `pane-controller` mobile-overlay tests caught it; #1007's own manual check verified the ARIA attributes but not that item content still rendered. Fix: `untrack` the count read in enter()/leave() so a write from an effect never establishes a self-dependency (the write still notifies the layout reader). The ref-count mutators are written from effects by design, so the untrack belongs in the store. Also fixes the second collision from the same #1007 change: the pane is now `role="dialog"` on mobile, so pane-controller.spec.ts:771's `[role="dialog"]` + text locator matched BOTH the pane and the BottomSheet (strict-mode violation). Target the sheet by accessible name ("Quick actions") instead — the pane's is "Item detail". The effect_update_depth_exceeded runaway only manifests under the real browser scheduler (not jsdom/vitest), so the E2E overlay tests own the loop regression; the unit tests lock the ref-count semantics. Claude-Session: https://claude.ai/code/session_01EZ6yr6pAUFb1uffan912ra
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes the red E2E on
main— two failures introduced by #1007 (TASK-2131, "full ARIA-modal isolation for the mobile detail pane"), both stemming from making the mobile panerole="dialog".1. The real defect — mobile pane renders empty (
effect_update_depth_exceeded)#1007 added a PaneHost
$effectthat callspaneOverlay.enter()/leave()toinertthe app-shell chrome behind the mobile overlay.enter()'soverlayCount += 1readsoverlayCountinside that tracked effect scope, so the effect took a reactive dependency on the very signal it writes:Svelte aborts the flush, which strands the rest of the subtree's reactivity:
paneMintForRoute(in the collection page) stopped recomputing, so{#if paneMintForRoute}stayed false and the mobile pane rendered completely empty — no item content, no Back chevron. #1007's manual Playwright check verified the ARIA attributes but not that item content still rendered.Fix:
untrackthe count read inenter()/leave()so a write from an effect never establishes a self-dependency. The write still notifies the layout'smobileOverlayActivereader normally. The ref-count mutators are written from effects by design, so theuntrackbelongs in the store (matches the existinguntrack-the-write idiom inUserSettingsForm.svelte/Lightbox.svelte).2. Test-locator collision
The pane is now
role="dialog"on mobile, sopane-controller.spec.ts:771's[role="dialog"]+ text locator matched both the pane (which contains the sheet) and the BottomSheet → strict-mode violation. Target the sheet by accessible name (getByRole('dialog', { name: 'Quick actions' })) — the pane's is "Item detail".Diagnosis
Bisected the red E2E to #1007 (parent
316e25a6green,b76abdd6red). Instrumented the collection page + PaneHost to trace the nav/mint sequence and captured theeffect_update_depth_exceededpageerror; confirmed by isolation that disabling the overlay effect removed the loop, and that restoring it withuntrackkeeps #1007's a11y isolation working.Verification
cd web && npm run check— svelte-check 0 errorspaneOverlay.svelte.test.ts— 4 pass (ref-count semantics)pane-controller(771 + 1178) now pass;pane-controller+pane-a11y-focus+pane-mobile-overlaysuite — 28 pass (1 unrelated documented tie-break flake, BUG-2270/2279)The
effect_update_depth_exceededrunaway only manifests under the real browser scheduler (not jsdom/vitest), so the E2E overlay tests own the loop regression; the unit tests lock the ref-count semantics.Fixes BUG-2284. Unblocks #1008 (IDEA-2135), whose E2E inherited this red.
https://claude.ai/code/session_01EZ6yr6pAUFb1uffan912ra