Repository navigation
fix(ui): stable server snapshot in useResponsive (#438) - #446
Merged
Merged
Conversation
Bumps @scaffald/ui to pick up Scaffald/ui#14, which had been open and unmerged for a week. `_getServerSnapshot` returned a fresh `{ width, height }` object on every call, so React saw the snapshot change on every read — exactly what "The result of getServerSnapshot should be cached to avoid an infinite loop" describes. useResponsive backs Box/Stack/Grid, so it runs many times per SSR page. Latent-bug removal: the warning does not currently reproduce on main with clean caches (full bisect in #438), but returning an unstable reference from getServerSnapshot violates React's documented contract regardless, and the apex renders server-side. Refs #438 Co-Authored-By: Claude Fable 5 <[email protected]>
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
Bumps the
@scaffald/uisubmodule to pick up Scaffald/ui#14, which had been open and unmerged — so the fix described in #438 as "did not resolve this" was in fact never in the tree at our submodule pointer._getServerSnapshotreturned a fresh{ width: 1280, height: 900 }on every call, so React saw the snapshot change on every read — precisely what "The result of getServerSnapshot should be cached to avoid an infinite loop" describes.useResponsivebacksBox/Stack/Grid, so it runs many times per SSR page.Framing this honestly as latent-bug removal, not a confirmed fix for #438 — see my investigation comment on the issue. The warning does not currently reproduce on
mainwith clean caches, so I can't claim causation. But returning an unstable reference fromgetServerSnapshotviolates React's documented contract, the apex renders server-side, and the change is two lines.Refs #438 (left open — the user-visible half is unresolved, details on the issue)
Verification
@scaffald/uirebuilds and typechecks clean;_SERVER_SNAPSHOTpresent indist; dev server boots and public job pages render with nogetServerSnapshotoutput.🤖 Generated with Claude Code