Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect caching behavior with revalidate time on unstable_cache #76769

Open
mastoj opened this issue Mar 3, 2025 · 0 comments
Open

Incorrect caching behavior with revalidate time on unstable_cache #76769

mastoj opened this issue Mar 3, 2025 · 0 comments

Comments

@mastoj
Copy link
Contributor

mastoj commented Mar 3, 2025

Link to the code that reproduces this issue

https://github.com/mastoj/next15-caching

To Reproduce

  1. Clone repo
  2. Deploy to vercel
  3. Go to /whatever
  4. When any of the timers are up click refresh

Current vs. Expected behavior

When any of the timers are out I would expect to get ONE STALE response and then the next refresh should load a new image for the timer that has ended and the timer should also be reset.

Instead it seems like I am always getting "old" cached data in my result.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.3.0: Thu Jan  2 20:24:23 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6020
  Available memory (MB): 65536
  Available CPU cores: 12
Binaries:
  Node: 20.14.0
  npm: 10.7.0
  Yarn: 1.22.22
  pnpm: 10.4.1
Relevant Packages:
  next: 15.2.0 // Latest available version is detected (15.2.0).
  eslint-config-next: 15.1.6
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.7.3
Next.js Config:
  output: N/A

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

Not sure

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

Vercel (Deployed)

Additional context

I noticed this when working on a demo application where I try to leverage unstable_cache with both revalidate time and revalidation tags. The revalidation tags works fine, but not the revalidate time. When the time is out the STALE response is served and that is also cached on the edge it seems, and when the revalidated data is ready it won't update the edge cache so I am still serving cache data. Then when the second timer is out it will serve the previous data because that is the last one cached.

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

No branches or pull requests

1 participant