Repository navigation
TanStack: Keep Start's document shell out of stories - #35504
huang-julien merged 2 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
ChangesRoot route cloning
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Follows #35501
What I did
A TanStack Start root route's
shellComponentrenders the document (html/head/body) inside the story canvas. React logs an invalid-nesting error for each document element, warns about hydration mismatches, and hoists the shell's head content into the real page.Rendering a story changes the document title and injects the app's meta tags into the Storybook page.
duplicateRouteTreenow stripsshellComponentfrom the copied root options. All other root behavior keeps working in stories: the root layout component,notFoundComponent,errorComponent, andbeforeLoadcontext.Similar implementations
#35217 identified this problem first and fixes it by not copying any root options. We ran both approaches against our
story-level conformance suite.
Dropping every root option also removes the root
notFoundComponent, error handling, and context that existing stories rely on, and those stories fail.Stripping only the shell fixes the document leak with no other behavior change, which is why this PR proposes the narrower version.
Manual testing
yarn vitest run code/frameworks/tanstack-react(55 tests).NoDocumentShellInStoriesstories fail without it, with document titlehijacked by the story.
AI disclosure
Root-cause analysis, fix, and tests developed with Claude (Claude Code), reviewed and submitted by me.
Summary by CodeRabbit