fix(one): keep layout loaderData in spa-shell + add react-test-renderer dep#711
Merged
Conversation
…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).
|
🚅 Deployed to the one-pr-711 environment in onestack.dev
|
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
Fixes both failures of
Checks and Testson the canary 1.17.10 release commit.1.
checksjob — depcheck failurepackages/one/src/router/web/__tests__/WebStackView.runtime.test.tsx(added in 41ed7ff) importsreact-test-rendererbut it was not declared inpackages/one's devDependencies. Addedreact-test-renderer@^19.2.0.2.
testsjob —layout-render-modesspa-shell regressionCommit 4daaa60 switched
ServerContextScript's leaf-stripping from reference-equality (vsrestContext.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.loaderDataisundefinedand the last item inrestContext.matchesis the last layout — its data exists nowhere else. The new code stripped that layout'sloaderData, leavinguseMatch(layoutRouteId)undefined after hydration.Fix: only strip the leaf's
loaderDatawhenrestContext.loaderData !== undefined— i.e., only when there's actually a leaf page loader value to be restored client-side ontomatches[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 dataDeeply Nested Layouts (SSG → SSR → SPA) > spa leaf inside ssr section hydrates with full match chainTest plan
cd packages/one && bun run check— depcheck cleancd tests/test-layout-render-modes && bun run test:dev— 47/47 passcd tests/test-layout-render-modes && bun run test:prod— 47/47 passcd packages/one && bun run test— 516/516 pass