Fix/reports rgl loop#74
Merged
Merged
Conversation
RGL fires onLayoutChange on every layout-prop change (recreated each render), and it always called setLayout, feeding an endless setLayout -> render -> onLayoutChange cycle (Maximum update depth). Skip the update when no tile actually moved or resized.
dev:turbo runs next dev --turbopack for faster cold compiles; plain dev stays on webpack as the safe default (react-grid-layout uses require).
contentRect.width is fractional and jitters sub-pixel as tiles auto-fit; since containerW is a fitHeights effect dependency, the raw value changed every render and never settled. Round and dedupe it.
Replace the continuous ResizeObserver on the content probe (which oscillated: shrink -> scrollbar -> reflow -> grow -> repeat) with an effect keyed on a width signature. Content height only changes with width (container queries), and height is deliberately not a dependency, so fitHeights setting h can never retrigger the measurement. Also make the tile body overflow-hidden so a transient scrollbar cannot reflow the container-query content.
Reset kept stale content-fit floors (possibly measured at another zoom level), so default heights could be wrong and tiles overlapped. Clear minHeights and force a fresh measure via a nonce after reset.
Rounding the measured width up made the grid (rendered at width= containerW) 1px wider than its container, toggling a horizontal scrollbar that shrank the container and looped. Floor the width and ignore sub-2px wobble.
Zoom toggled whether the report content overflowed, so the vertical scrollbar appeared/disappeared and the container width jumped ~15px, oscillating containerW forever. Force overflow-y-scroll so the scrollbar gutter is always reserved (constant width). Also drop the rglLayout h override so the rendered height matches stored state and RGL stops echoing it back through onLayoutChange.
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.
Summary
Type of change
Checklist