Repository navigation
fix(web): observe the ExpandedLayRate region once the modal has portaled - #1213
Merged
Merged
Conversation
Modal renders its children into a portal on a second commit, so the mount effect that created the ResizeObserver found scrollerRef null and returned. After a resize the window box, edge cues, pager and caption kept describing the old width until the next scroll. A ref callback runs in the portal's own commit; its cleanup disconnects on unmount. Closes #1203
Owner
Author
|
Before and after frames, 1:1, light theme, from the isolated stack rebuilt at main's component and at |
Owner
Author
|
Review round 1 (Codex, read-only) at
VERDICT: 0 product defects, 0 test/doc-only findings. |
The chart file crossed the 500-line limit by six lines. The range picker is a private sub-component used only here, so it moves to its own file with the imports it owns. No behaviour change.
This was referenced Oct 11, 2026
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.


Closes #1203
What changed
Modalrenders its children into a portal on a second commit. The effect that created the region'sResizeObserverran on the first commit, foundscrollerRefnull and returned, and nothing re-ran it untildayschanged. The region is now observed from a ref callback, which runs in the portal's own commit. Its cleanup disconnects the observer when the node unmounts orsyncchanges.What the observation feeds, and why nothing visible changes today
sync()reads the region's width and scroll position to place the window box on the map, light the edge cues, enable the pager, choose fixed slots or a stretched strip, and write the "days shown" caption. The observer is what re-reads it when the window resizes or the phone rotates; without it only a scroll does.The Dashboard never shows the defect. It sets the expanded report to null before every read, on open and on every range or flock change, so the region always mounts after
dayswent to 0 and back. That identity change re-ran the old effect once the region existed, and the observer attached. The region only mounts withdaysunchanged when a caller passes data on the first commit, which is what the test does and what the Dashboard does not. The component no longer depends on its caller cycling data through null.Before and after frames from a stack rebuilt at each head are byte-identical for the scenario closest to the defect (reopen the chart with its report already held, then shrink the window from 1280 to 700). Checksums are in the comment below.
Siblings checked
git grep -n ResizeObserver web/srcfinds two other users.useDayStripobserves the readout box and its dock from an effect keyed on the selected day, which is when the box mounts, so it attaches on first selection in both the card and the modal.FieldConsole's two observers watch nodes rendered in the same commit as their component, with no portal. Neither changed.Proof
follows the region when it resizes, and lets go of it on unmount, run against main'sExpandedLayRate.tsxin this worktree: fails withexpected undefined to be defined(no observer on the region). Against this branch: passes.npx vitest run src/components/ExpandedLayRate.test.tsx src/components/DayStrip.test.tsx --maxWorkers=2: 39 passednpm run typecheckandnpm run lint: cleancw1203on port 8203, built once at2517f991and once with main's component, both torn down withdown -vand the image removed.File-size guard
The chart file crossed the 500-line limit by six lines, so the private
ExpandedRangePickermoved toweb/src/components/ExpandedRangePicker.tsxwith the imports it owns (commit7d09bac7). No behaviour change;FileSizeLimitTestspasses locally and no legacy entry was added.