Repository navigation
Description
Every page in the local dev server logs this repeatedly:
The result of getServerSnapshot should be cached to avoid an infinite loop
Reproduced on /jobs/<slug> (public, no login needed) at a 375×812 viewport. It fires many times per load, and on that page the splash overlay stops responding to clicks — "Skip" and the cookie banner buttons do nothing — which is consistent with a render loop, though I haven't proven the two are the same fault.
What I ruled out
packages/ui's useResponsive had a genuine version of this bug — _getServerSnapshot allocated a fresh { width: 1280, height: 900 } on every call, which is exactly what the warning describes. Fixed in Scaffald/ui#14.
It did not resolve this. The error still fires after:
- rebuilding
packages/ui/distwith the fix present (verified_SERVER_SNAPSHOTin the output) - wiping the Metro cache,
apps/scaffald/.expoandnode_modules/.cache - a full cold rebuild of the dev server
- confirming both
node_modules/@scaffald/uisymlinks resolve to the fixed copy
And useResponsive is the only useSyncExternalStore call site in the entire workspace — packages, apps, and both submodules. Nothing in node_modules implements getServerSnapshot except react-devtools-core.
So the remaining source is almost certainly inside react-native-web or expo-router — both of which use useSyncExternalStore internally and are exactly the layers SSR exercises hardest.
Why it matters
The apex runs server-rendered (web.output: 'server'). An unstable server snapshot means React can re-render in a loop during hydration, which costs CPU on first paint for every visitor to a public page — the marketing landing, profiles, job listings. It also buries real errors under identical noise, which is how the notification-panel bug (#382) went unnoticed for months.
Suggested next step
Bisect by rendering a trivial route with no layout primitives and see whether it still fires; that separates our component tree from the router/runtime. If it's expo-router, worth checking against SDK 56 upstream issues before working around it.
Not urgent — it's a warning, not a crash, and production has been serving fine. But it should not be permanent background noise.
Activity
thinkclay commentedon Jul 30, 2026
Bisected. It is not our code, and the scope is narrower than I could claim before.
The decisive test
Created a route containing nothing but raw react-native primitives — no
@scaffald/ui, noscf-core, no providers:Also short-circuited the root
_layoutto render<Stack>alone, withSafeAreaProvider/UniversalThemeProvider/ThemeBridge/GestureHandlerRootView/Provider/ErrorBoundaryall removed.The warning still fires — after
watchman watch-del, a wiped Metro cache, wiped.expo, and a cold rebuild. So it comes fromexpo-router/react-native-web/ the React 19 renderer, not from anything we wrote or compose.Suspects, from reading the source
expo-routerhas tenuseSyncExternalStorecall sites. Most pass stable references (store.getState,navigation.isFocused, arrow-boundloaderCache.getSnapshot— that one even has a comment explaining the stability requirement). Two are worth a closer look:global-state/useRouteInfo.js→store.getRouteInfo, which returnsstoreRef.current.routeInfo || defaultRouteInfo.defaultRouteInfois a module constant, so it's stable itself — butgetRouteInfoFromStatespreads it ({ ...defaultRouteInfo, ... }) on the not-found/sitemap path, producing a fresh object per call.routeInfoCacheexists precisely to dedupe these, keyed on aWeakMapoverstateplus aJSON.stringifyvalue cache — so a miss during hydration would return a new identity.imperative-api.js→routingQueue.snapshot, which returnsroutingQueue.queue.run()reassignsqueue = [], so identity changes by design, though that alone shouldn't trip the server snapshot check.@tanstack/react-queryis clean — every call site passes() => observer.getCurrentResult()backed by a cached observer result.Also observed
Every load logs
An error occurred in the <ContextNavigator> component(twice, matching the double render).ContextNavigatoris expo-router's own — likely the same fault surfacing as a caught error rather than a separate one.What I tried and could not use
An interception wrapper around
React.useSyncExternalStore(to print the offendinggetServerSnapshotsource) never installed — Metro's module registry hands each consumer its own binding, so mutating thereactexport from app code doesn't reachnode_modulescallers. Patchingreact-dom's dev bundle to log the offender was blocked by the sandbox. Both are dead ends worth recording so nobody repeats them; a working approach would be a Metroresolveralias or patching viapnpm patch.Status
Scaffald/ui#14 still stands on its own merits —
useResponsivedid return a fresh object fromgetServerSnapshot, which is a real contract violation — but it is confirmed not the cause here. The superproject submodule pointer has been left at the current commit; it should be bumped after that PR merges, not before.Next step for whoever picks this up:
pnpm patch expo-routerand log identities inuseRouteInfo, or check SDK 56 upstream for an existing report before working around it.thinkclay commentedon Jul 30, 2026
Picked this up. Three results: one cause found, two red herrings eliminated, and the user-visible half is still unresolved.
1. Scaffald/ui#14 was never merged
The PR was still open, so our submodule pointer (
262b73d) still contained the buggy_getServerSnapshot. I verified by reading the source at our pinned SHA — the fresh-object-literal return was right there.That's very likely why "rebuilding
packages/ui/distwith the fix present" appeared not to help:apps/scaffald/metro.config.jsprefers thesourceexport condition for workspace packages, so the dev server bundlespackages/ui/src/**, notdist. Rebuildingdistwith a fix in a local working copy changes nothing the dev server reads. Merged as Scaffald/ui#14 → PR #446 bumps the pointer.2. But I could not reproduce the warning, so I'm not claiming #14 fixes this
Being explicit because it matters for closing this out:
/jobs/pipe-welder-fabricator-apex, with a week-old Metro cache.rm -rfof metro-cache +apps/scaffald/.expo+node_modules/.cache, the warning stopped — with the fix applied.So the variable that actually correlated was cache state, not the source. The one observation came from a stale bundle compiled from older code — the metro-cache trap pattern again. I can't prove #14 was the cure, and I'd rather say that than imply a fix I didn't demonstrate.
Worth re-checking on a machine that still has a stale cache, if anyone has one.
3. Two things ruled out (so nobody else chases them)
DIV#S:0next toDIV#rootis not a duplicate app. I briefly thought it was — it holds a full second copy of the banner markup. It's React's streaming-SSR Suspense placeholder:display: none, 0×0, inert. Not the fault.4. Still unresolved: the clicks-do-nothing symptom
This half reproduces reliably and I think it's the part that actually hurts users:
On
/jobs/<slug>at 375×812, clicking Reject on the cookie banner with a real mouse event does nothing — no consent written tolocalStorage, banner stays up. Same forSkipon the splash.What I established:
document.elementFromPointat the button's centre returns the button itself;pointer-events: autoall the way up the chain; no overlay above it.CookieConsentBanner's Reject →rejectAll→persistSelections→setConsentState, and the banner gates onisReady && !consentState..click()behaves differently from a real click: it does write consent tolocalStorage, but the banner still doesn't hide. A real click writes nothing at all.That split (handler reachable programmatically, not via real pointer events; and state written without the UI reacting) points at react-native-web
Pressableevent handling under SSR hydration rather than anything in our banner code. I didn't get to the bottom of it and don't want to guess further.Suggest: keep this issue open for the click bug and retitle it accordingly, since the
getServerSnapshotline is now the less important half. Happy to keep digging if it's worth prioritising — it affects every public page (marketing, job listings, profiles), which makes it more than cosmetic.thinkclay commentedon Jul 30, 2026
Follow-up on the clicks-do-nothing half. I have it narrowed to two separate faults, both reproducible on
/jobs/<slug>at 375×812 (which redirects to/authfor a signed-out user — the banner and login form are what's on screen).Fault A — the press only fires from a bare
clickevent, not from a real pointer sequenceThree tests against the same Reject button on one fresh page load:
Input.dispatchMouseEvent, correct coords, verified 2× DPR)pointerover/enter/down+mousedown+pointerup/mouseup, no trailingclickelement.click()(dispatches only aclickevent)Supporting detail: the button's React props contain
onClickand no pointer/responder handlers —["onMouseEnter","onMouseLeave","onKeyDown","onClick","onContextMenu","onBlur","onFocus"]. It is not disabled (disabled: false, noaria-disabled), nothing overlays it (elementFromPointat its centre returns the button;pointer-events: autofor ten ancestors up), and no ancestor carries responder/scroll handlers.So the press path is
onClick-only, and a genuine pointer-down→up→click sequence does not reach it. The shape of that — a realpointerdownsuppressing the trailingclick— is consistent with react-native-web's document-level responder listeners callingpreventDefault()on pointerdown, which in Blink can cancel the click that follows. I did not confirm that mechanism in RNW's source, so treat it as the leading hypothesis, not a conclusion.Correction to something I implied earlier: I also tried invoking
props.onClick(fakeEvent)directly and it didn't write consent. Discount that result — my hand-rolled event object was almost certainly missing fields the handler reads, so it proves nothing either way.Caveat worth stating: all of my "real" clicks come through CDP. That's normally indistinguishable from human input, but if RNW's behaviour depends on trusted-sequence specifics, a human mouse might behave differently. Since you observed the same dead buttons independently, I think it's real for humans — but someone should confirm with a physical click before anyone invests in an RNW workaround.
Fault B — persisting consent at runtime does not hide the banner
Independent of A, and cleanly reproducible:
element.click()on Reject →scf-cookie-consentis written tolocalStorage→ banner stays visible.So load-time gating works and runtime state propagation doesn't. The chain reads correctly on paper (
rejectAll→persistSelections→setConsentState, banner gated onisReady && !consentState), which makes this the more interesting of the two: the visible banner isn't re-rendering off the state that was just set. Worth checking whetherCookieConsentProviderends up mounted more than once, givenpackages/scf-core/provider/index.tsxbuilds the tree through areduce-basedcomposewith no initial value.Why this matters more than the console warning
Fault A means no button on a public page responds to a first-load press — I confirmed "Sign in with password" is equally dead, so it isn't banner-specific. That's every visitor to the marketing landing, job listings and profiles on the apex.
I'd suggest retitling this issue to the click failure and demoting the
getServerSnapshotline to a footnote (PR #446 lands the stable-snapshot fix as latent-bug removal regardless).Stopping here rather than guessing at an RNW workaround — happy to keep going if you want this prioritised, but the next step is either an upstream RNW/expo-router check for SDK 56 or a physical-click confirmation, and you're better placed to say which.
thinkclay commentedon Jul 30, 2026
Two notes to keep the trail accurate, then I'm parking this.
The doubled
CookieConsentProviderin the fiber tree is benign — don't chase it. Walking the live fiber up from the Reject button gives:Two entries with the same name looks like a duplicate mount, and I thought it might explain Fault B. It doesn't:
packages/scf-core/provider/cookie-consent/CookieConsentProvider.tsximports the ui one asCookieConsentProvider as BeyondCookieConsentProviderand renders it inside itself, so both fibers legitimately carry the nameCookieConsentProvider. One logical provider, nested wrapper. I also confirmed thereduce-basedcomposeinprovider/index.tsxmounts it once, and that there is exactly one Reject button in#root.Fault B is therefore deeper than a context/memo mistake. For the record I checked and ruled out the obvious candidates:
useMemodeps on the context value are complete —consentStateandshouldShowBannerare both listed.rejectAll's own output ({"version":"1","updatedAt":…,"selections":{"strictly-necessary":true,"performance":false}}), sopersistSelectionsreally ran, which meanssetConsentState(state)ran on the same provider that renders the visible banner.That combination is genuinely odd and I don't want to speculate further without reading RNW/React internals properly.
One caveat on my own evidence, since it affects how much weight to give Fault B: during part of the session a
#S:0streaming placeholder was present that also contained a Reject button, so an unscopedquerySelectorAll('button')could have targeted the wrong copy. The Fault B measurement I trust is the one scoped explicitly todocument.querySelector('#root')— that one wrote consent and left the#rootbanner visible. The unscoped variants should be re-run by whoever picks this up.Net for triage: Fault A (first-load presses dead on public pages) is the one with clean, repeatable evidence and the real user impact. Fault B is real but its mechanism is unexplained. PR #446 is independent of both.
fix(ui): stable server snapshot in useResponsive (#438) (#446)
thinkclay commentedon Jul 30, 2026
Noting for anyone who lands here later: this was closed as not planned at 11:17, which was before my last two comments went up — so the investigation notes above outlived the issue.
The
getServerSnapshothalf is genuinely resolved: Scaffald/ui#14 had been sitting open and unmerged, and PR #446 landed the stable-snapshot fix onmain(submodule now at043505e). Closing this is fair on that basis.The two faults I found while digging are not resolved, so I've refiled them standalone rather than leaving them in comments here:
clickevent does work. Higher impact than the warning that opened this issue.Both carry the full evidence, the red herrings I ruled out (
#S:0is an inert streaming placeholder; the doubledCookieConsentProvideris a same-named nested wrapper), and an explicit caveat that all my "real" clicks came via CDP and want a physical-mouse confirmation before anyone writes an RNW workaround.No action needed on this issue — pointers only.