Skip to content

docs(Suspense): warn against module-level cache in SSR#8485

Open
LuxologyGG wants to merge 1 commit into
reactjs:mainfrom
LuxologyGG:fix/auto-issue-8134
Open

docs(Suspense): warn against module-level cache in SSR#8485
LuxologyGG wants to merge 1 commit into
reactjs:mainfrom
LuxologyGG:fix/auto-issue-8134

Conversation

@LuxologyGG

Copy link
Copy Markdown

Summary

Fixes #8134

The Suspense reference page examples include a hidden data.js file with a module-level Map cache. Copying this pattern into server environments like Next.js can leak data across requests.

This PR:

  • Adds a Pitfall warning before the first Suspense example
  • Clarifies the data.js comment in all eight Suspense examples that the module-level cache is only for this client-only demo

What type of PR is this? (check all applicable)

  • Documentation

Test plan

  • Verified the Pitfall renders on the Suspense reference page
  • Confirmed all eight data.js hidden files include the updated comment

Add a Pitfall on the Suspense reference page explaining that the
hidden data.js cache must not be copied into server environments like
Next.js, where module-level state can leak data across requests.

Clarify the data.js comment in all Suspense examples accordingly.

Fixes reactjs#8134
@github-actions

Copy link
Copy Markdown

Size changes

Details

📦 Next.js Bundle Analysis for react-dev

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@LuxologyGG LuxologyGG marked this pull request as ready for review June 20, 2026 00:36
Copilot AI review requested due to automatic review settings June 20, 2026 00:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

[Typo]: Suspense example code promoting data leakage when used in Next.js under app router

3 participants