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

@LuxologyGG LuxologyGG commented Jun 19, 2026

Copy link
Copy Markdown

Summary

Closes #8134

The Suspense reference page examples include a hidden data.js file with a module-level Map cache that, if copied into server environments like Next.js, can leak data across requests.

This PR adds a Pitfall warning before the first Suspense example and clarifies in all eight data.js hidden files that the module-level cache is only for the client-only demo.

Before / After

Before: Module-level Map cache in data.js with no warning about server-side use.

After: Pitfall callout at the top of the Suspense examples plus a comment in each data.js file: "This module-level cache is only suitable for this client-only demo. Do not copy it into server environments."

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