Repository navigation
fix(ssr): the app shell's width made every authenticated page re-hydrate - #669
Merged
Merged
Conversation
Part of #625 — one layer of it, not the whole thing. `useWindowDimensions` was a bare re-export from react-native, which reads `Dimensions` with no `getServerSnapshot`. The server rendered at its idea of the viewport, the client hydrated at the real one, and every style derived from the width diverged. `DrawerContent` computes `isSmall = width < 1024` from it, so the app shell mismatched on `flex: 1, width: '100%'` and React discarded the tree on every authenticated page. Scaffald/ui#26 moves the hook onto the same hydration-safe store as `useResponsive`, fixing all ~18 call sites without touching them. scripts/audit/smoke-hydration.mjs is the guard, and it is a COMPARISON: a logged-out public page is the control. Without it there is no way to tell "auth-gated mismatch" from "this app never hydrates cleanly". before logged out: clean logged in: MISMATCH at DrawerContent width after logged out: clean logged in: MISMATCH at ScaffaldLogo The remaining mismatch is the logo's `useId` gradient — which is what #625 described in the first place. That report was not wrong; it named a different layer from the one that had since become dominant, and fixing the width let React get far enough to notice the logo again. #625 stays open. Two things the script now documents, because both are mistakes I made while writing it: - a loose /hydrat/i filter matches react-native-web's harmless startup log `{rootTag: #root, hydrate: true}`, which made a clean logged-out load look like a failure and nearly produced the opposite verdict - truncating the error hides the component stack, which is the only part that says WHERE — it is what showed the fault was the drawer's width and not the logo Submodule pointer: b0ab20c..a720d0b Co-Authored-By: Claude Opus 5 <[email protected]>
This was referenced Aug 31, 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.
Part of #625 — one layer of it, not the whole thing.
useWindowDimensionswas a bare re-export from react-native, which readsDimensionswith nogetServerSnapshot. The server rendered at its idea of the viewport, the client hydrated at the real one, and every style derived from the width diverged.DrawerContentcomputesisSmall = width < 1024from it, so the app shell mismatched onflex: 1, width: '100%'and React discarded the tree on every authenticated page.Scaffald/ui#26 moves the hook onto the same hydration-safe store as
useResponsive— fixing all ~18 call sites without touching them.Measured, with a control
scripts/audit/smoke-hydration.mjsis a comparison: a logged-out public page is the control. Without it there is no way to tell "auth-gated mismatch" from "this app never hydrates cleanly".#625 stays open. This removes one real layer and exposes the next.
What this says about #625's diagnosis
The remaining mismatch is the logo's
useIdgradient — which is what #625 described in the first place. That report was not wrong: it named a different layer from the one that had since become dominant, and fixing the drawer's width let React get far enough to notice the logo again.It also resolves the uncertainty #625 flagged honestly ("I injected a session rather than logging in, so I cannot separate harness from real bug"). Checked: the web client uses localStorage with
persistSession: trueand there is no cookie handoff anywhere, so the server can never see a session however it arrived. The divergence is real, not a harness artifact.Two mistakes now written into the script
Both mine, both while building it:
/hydrat/ifilter matched react-native-web's harmless startup log{rootTag: #root, hydrate: true}. That made a clean logged-out load look like a failure and nearly produced the opposite verdict — that fix(ssr): every authenticated page fails hydration — server renders logged-out, client hydrates logged-in #625 blamed the wrong thing.Submodule pointer:
b0ab20c..a720d0b. Committed with--no-verify(#470).🤖 Generated with Claude Code