Skip to content

fix(one): keep layout loaderData in spa-shell + add react-test-renderer dep#711

Merged
natew merged 1 commit into
mainfrom
fix/ci-checks-tests-spa-shell
May 26, 2026
Merged

fix(one): keep layout loaderData in spa-shell + add react-test-renderer dep#711
natew merged 1 commit into
mainfrom
fix/ci-checks-tests-spa-shell

Conversation

@natew

@natew natew commented May 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes both failures of Checks and Tests on the canary 1.17.10 release commit.

1. checks job — depcheck failure

packages/one/src/router/web/__tests__/WebStackView.runtime.test.tsx (added in 41ed7ff) imports react-test-renderer but it was not declared in packages/one's devDependencies. Added react-test-renderer@^19.2.0.

2. tests job — layout-render-modes spa-shell regression

Commit 4daaa60 switched ServerContextScript's leaf-stripping from reference-equality (vs restContext.loaderData) to index-based (i === lastMatchIndex), to keep two layouts with primitive-equal loaderData from both losing their data.

The new logic breaks spa-shell mode: SPA pages are not server-rendered, so restContext.loaderData is undefined and the last item in restContext.matches is the last layout — its data exists nowhere else. The new code stripped that layout's loaderData, leaving useMatch(layoutRouteId) undefined after hydration.

Fix: only strip the leaf's loaderData when restContext.loaderData !== undefined — i.e., only when there's actually a leaf page loader value to be restored client-side onto matches[last]. This preserves the original fix's intent (no false-positive primitive-equal stripping) while not stripping layouts in spa-shell.

Failing tests that now pass:

  • SSR Shell + SPA Content > client navigation preserves ssr shell loader data
  • Deeply Nested Layouts (SSG → SSR → SPA) > spa leaf inside ssr section hydrates with full match chain

Test plan

  • cd packages/one && bun run check — depcheck clean
  • cd tests/test-layout-render-modes && bun run test:dev — 47/47 pass
  • cd tests/test-layout-render-modes && bun run test:prod — 47/47 pass
  • cd packages/one && bun run test — 516/516 pass
  • CI green on this branch

…er dep

- ServerContextScript: only strip leaf match's loaderData when
  restContext.loaderData is defined. in spa-shell mode the page is not
  server-rendered (loaderData=undefined) and the leaf in matches is a
  layout whose data exists nowhere else; index-based stripping wiped it.
- add react-test-renderer to packages/one devDependencies (used by
  WebStackView.runtime.test.tsx; depcheck was failing the CI check job).
@railway-app railway-app Bot temporarily deployed to onestack.dev / one-pr-711 May 26, 2026 04:56 Destroyed
@railway-app

railway-app Bot commented May 26, 2026

Copy link
Copy Markdown

🚅 Deployed to the one-pr-711 environment in onestack.dev

Service Status Web Updated (UTC)
one ✅ Success (View Logs) Web May 26, 2026 at 4:59 am

@natew natew added this pull request to the merge queue May 26, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 26, 2026
@natew natew merged commit 38aa946 into main May 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant