nextjs - 💡(How to fix) Fix React cache incompatible with Next.js cache components [3 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#86997Fetched 2026-04-08 02:08:05
View on GitHub
Comments
3
Participants
3
Timeline
12
Reactions
0
Author
Timeline (top)
subscribed ×5commented ×3mentioned ×2issue_type_added ×1

Code Example

Running cacheTest function for key uncached
Running cacheTest function for key cached
Running cacheTest function for key cached

---

Running cacheTest function for key uncached
Running cacheTest function for key cached

---

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Mon Aug 11 21:16:21 PDT 2025; root:xnu-11417.140.69.701.11~1/RELEASE_ARM64_T6000
  Available memory (MB): 32768
  Available CPU cores: 10
Binaries:
  Node: 24.11.0
  npm: 11.6.1
  Yarn: 1.22.22
  pnpm: 10.25.0
Relevant Packages:
  next: 16.0.8 // Latest available version is detected (16.0.8).
  eslint-config-next: N/A
  react: 19.2.1
  react-dom: 19.2.1
  typescript: 5.9.3
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/mattfc-ct/react-cache-test

To Reproduce

Reproduction repo is created with npx create-next-app

  1. Start the dev server with npm run dev or build/start with npm run build && npm run start
  2. Load the homepage http://localhost:3000
  3. Observe the console log

Current vs. Expected behavior

Current behavior:

Note the following output:

Running cacheTest function for key uncached
Running cacheTest function for key cached
Running cacheTest function for key cached

This indicates that the React cache function is not caching when using "use cache", but it is working when uncached.

Expected behavior

The output should be:

Running cacheTest function for key uncached
Running cacheTest function for key cached

Meaning, the React cache function should cache the same way whether "use cache" is present or not.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Mon Aug 11 21:16:21 PDT 2025; root:xnu-11417.140.69.701.11~1/RELEASE_ARM64_T6000
  Available memory (MB): 32768
  Available CPU cores: 10
Binaries:
  Node: 24.11.0
  npm: 11.6.1
  Yarn: 1.22.22
  pnpm: 10.25.0
Relevant Packages:
  next: 16.0.8 // Latest available version is detected (16.0.8).
  eslint-config-next: N/A
  react: 19.2.1
  react-dom: 19.2.1
  typescript: 5.9.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

cacheComponents

Which stage(s) are affected? (Select all that apply)

next dev (local), next build (local), next start (local)

Additional context

Tested on 16.0.0 and 16.0.8 and 16.1.0-canary.16 and same behavior is observed.

extent analysis

TL;DR

The issue can be mitigated by investigating the cache implementation in the react-cache-test repository and ensuring that the cache function is correctly configured to cache results when using the "use cache" option.

Guidance

  • Review the cacheTest function implementation to verify that it is correctly caching results when the "use cache" option is enabled.
  • Check the cache configuration and ensure that it is properly set up to cache results for the "cached" key.
  • Investigate the differences in behavior between the "uncached" and "cached" keys to identify the root cause of the issue.
  • Consider testing the cache function in isolation to determine if the issue is specific to the Next.js environment or a more general caching problem.

Example

No code snippet is provided as the issue lacks specific implementation details.

Notes

The issue may be related to the specific implementation of the cache function or the configuration of the caching mechanism in the react-cache-test repository. Further investigation is needed to determine the root cause of the issue.

Recommendation

Apply workaround: The issue can be mitigated by modifying the cache implementation to correctly cache results when using the "use cache" option, although the exact changes required are unclear without further investigation.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING