Skip to content

docs(react-query): fix undefined userId in dependent query prefetch example - #11504

Open
changbaebang wants to merge 1 commit into
TanStack:mainfrom
changbaebang:docs/ssr-dependent-query-example
Open

changbaebang wants to merge 1 commit into
TanStack:mainfrom
changbaebang:docs/ssr-dependent-query-example

Conversation

@changbaebang

@changbaebang changbaebang commented Sep 15, 2026

Copy link
Copy Markdown

🎯 Changes

The server-side snippet in the React SSR guide's Prefetching dependent queries section checks user?.userId and then uses an undeclared userId inside the second queryClient.query(...) call, so the example throws a ReferenceError when copied as-is.

The client-side example directly above it (and the same section in the Preact SSR guide) already use user?.id. This aligns the server-side snippet with them: user?.id / user.id.

Docs-only, no code change.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested code changes locally with pnpm run test:pr, or these tests do not apply to this pull request.
  • I fully understand the code in this pull request, including any code generated with AI assistance.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Documentation
    • Updated the React SSR guide’s dependent-query prefetching example to use the user’s id when fetching projects.
    • Aligned the projects query key with the user identifier used by the example.

…xample

The server-side example in the SSR guide checked `user?.userId` and then
referenced an undeclared `userId` variable. Align it with the client-side
example above it (and the Preact guide) by using `user?.id` / `user.id`.
@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 5549be5f-38c2-4e34-91a9-e30e18d419af

📥 Commits

Reviewing files that changed from the base of the PR and between 58ad3e2 and 001b4b1.

📒 Files selected for processing (1)
  • docs/framework/react/guides/ssr.md

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The SSR guide now uses user.id consistently when prefetching dependent project queries. The condition and query key now match the user ID derivation shown earlier in the guide.

Changes

SSR documentation

Layer / File(s) Summary
Dependent query prefetch example
docs/framework/react/guides/ssr.md
The example checks user?.id and uses ['projects', user.id] instead of user?.userId and a separate userId variable.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~2 minutes

Change: Other

Suggested reviewers: sukvvon

Merge Risk: ⚪ Minimal · up to 001b4

The SSR example now uses the user ID consistently and is safe to copy without the previous undefined reference.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the React Query documentation fix and the undefined userId issue in the dependent query prefetch example.
Description check ✅ Passed The description follows the required template, explains the documentation change and motivation, completes the checklist, and identifies the change as docs-only with no release impact.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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