Repository navigation
Description
Split out of #625, which is fixed. This is the part that is not.
What remains
#625 was reported as a hydration mismatch on ScaffaldLogo's gradient id. #678 fixed that by keying the id on the gradient's colours instead of on useId, which encodes the component's position in the React tree.
That removed the symptom. It did not remove the cause: the server and the client do not agree on tree position for an authenticated page.
Evidence
Emit a throwaway useId alongside the now-fixed id and render it into an attribute that survives to the DOM:
// in ScaffaldLogo, temporarily
const probePosition = useId()
return <Svg ... data-probe={probePosition}>React's own hydration diff, on /dashboard with a session:
+ data-probe="_R_2qjaqb9_" (client)
- data-probe="_R_badb9d6_" (server)
Two notes on technique, both of which cost time to learn:
- Do not read the value back from the DOM. React says "This won't be patched up", so the server's value stays in the DOM and a
document.querySelectorprobe reads the server value on both sides and reports a false match. The+/-lines in the console message are the only place both values appear. Viewfrom react-native-web drops unknowndata-*props, so a probe there emits nothing.Svgfrom react-native-svg forwards them, which is why the probe has to sit on an SVG element.
Why it is currently invisible
ScaffaldLogo was the only useId consumer in the authenticated shell. packages/ui/src/accessibility/useId.ts is exported from the package but used by no component in it. Nothing else in the shell depends on tree position, so the divergence has no way to express itself.
Add one useId anywhere in the shell — a form control, a labelled input, an aria-describedby — and it comes straight back, on every SSR route.
What is known and not known
Known:
- Hydration succeeds; the DOM matches. This is the attribute warning, not tree regeneration.
- The server does not render a logged-out tree —
curl /dashboardwith no session returns the drawer nav and the logo. - The divergence is in the root-most part of the path: across probe placements the ids share a suffix (
...db9d6_server,...jaqb9_client) and differ in the leading segment, which is the end of the tree-id encoding nearest the root.
Not known:
- Which ancestor.
SafeAreaProvideris worth checking first — it rendersnulluntil it has insets unlessinitialMetricsis supplied, which is exactly the shape of thing that changes a subtree's child count without changing DOM output.apps/scaffald/app/_layout.tsx:97mounts it above everything.
Acceptance
- Identify the ancestor whose rendered child count differs between server and client
- Server and client agree on
useIdfor a probe component mounted in the shell - A
useIdconsumer can be added to the shell without reintroducing a mismatch — the regression test for this issue, since that is the condition that is currently untestable
Activity
feat(jobs): make /jobs public, and stop the listing answering with 95…
feat(jobs): make /jobs public, and stop the listing answering with 95…