Skip to content

Docs: Clarify TanStack Query client tradeoffs - #35314

Merged
Sidnioulz merged 1 commit into
storybookjs:nextfrom
nightt5879:nightt5879/clarify-tanstack-query-docs
Jun 29, 2026
Merged

Sidnioulz merged 1 commit into
storybookjs:nextfrom
nightt5879:nightt5879/clarify-tanstack-query-docs

Conversation

@nightt5879

@nightt5879 nightt5879 commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #35283.

Adds clarification to the TanStack React framework docs explaining why the recommended TanStack Query setup uses one shared QueryClient that is cleared between stories.

The new note also documents when a per-story QueryClient can be useful, especially for multiple stories rendered on the same Docs page with the same query keys, and calls out the tradeoffs around keeping the router context and QueryClientProvider wired to the same client.

What changed

  • Clarified that the shared client keeps router context, decorators, loaders, portable stories, Docs, and test runs using one predictable integration point.
  • Documented the stronger isolation provided by per-story clients.
  • Documented the risks of mismatched router/provider clients and the need to clean up per-story client-owned state.

Testing

  • corepack yarn install --immutable --mode=skip-build
  • corepack yarn fmt:write
  • corepack yarn docs:check

Manual testing

Docs-only change. Manually reviewed the rendered Markdown source around the TanStack Query section to confirm the new guidance appears after the setup snippet and before the per-story seeding example.

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b8550614-818a-4a7f-8e34-c8cb9bcdeb02

📥 Commits

Reviewing files that changed from the base of the PR and between bf34cdb and 8bc4ba7.

📒 Files selected for processing (1)
  • docs/get-started/frameworks/tanstack-react.mdx

📝 Walkthrough

Walkthrough

Adds four lines to the TanStack React framework docs explaining that the shared QueryClient is used across all Storybook render modes, and describing the per-story QueryClient isolation alternative, including wiring and cleanup requirements.

Changes

TanStack QueryClient Documentation

Layer / File(s) Summary
QueryClient setup guidance
docs/get-started/frameworks/tanstack-react.mdx
Adds text clarifying shared QueryClient usage across Storybook render modes and the per-story isolation alternative, including the requirement to pass the same client to both parameters.tanstack.router.context and QueryClientProvider, plus explicit cleanup.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nightt5879

Copy link
Copy Markdown
Contributor Author

I don't have permission to add the required workflow labels on this repository. Suggested labels for this docs-only PR: \documentation, \ci:docs, \qa:skip.

@huang-julien huang-julien left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you !

@huang-julien huang-julien added documentation ci:docs Run the CI jobs for documentation checks only. qa:skip Pull Requests that do not need any QA. (e.g. documentation) labels Jun 29, 2026
@Sidnioulz Sidnioulz self-assigned this Jun 29, 2026
@Sidnioulz Sidnioulz moved this to In Progress in Core Team Projects Jun 29, 2026
@Sidnioulz
Sidnioulz merged commit de7413a into storybookjs:next Jun 29, 2026
20 of 25 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Core Team Projects Jun 29, 2026
@github-actions github-actions Bot mentioned this pull request Jun 29, 2026
2 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-scan:automated ci:docs Run the CI jobs for documentation checks only. documentation qa:skip Pull Requests that do not need any QA. (e.g. documentation)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Documentation]: Clarify downsides of current TanStack Query integration

3 participants