Skip to content

On Vercel only: unstable_cache serves stale data when revalidated twice in succession, Router Cache doesn't update #60680

@mordechaim

Description

@mordechaim

Link to the code that reproduces this issue

https://github.com/mordechaim/vercel-revalidate

To Reproduce

  1. Navigate to the deployment on https://vercel-revalidate-three.vercel.app/
  2. Check the date, it should be the date of the last time someone pressed the "Revalidate" button
  3. Press once: The date properly updates
  4. Press again: nothing happens

Another issue I noticed with this reproduction: Refreshing the page will show the old data until a 2nd refresh is done.

Current vs. Expected behavior

unstable_cache serves stale data when revalidating more than once in a short period.

When running next build && next start and trying locally, everything works flawlessly.

The expected behavior is to always show the latest date.

The other issue is that even when the router cache does update (after a single revalidation), refreshing will show stale data until a second refresh is done.
I'm not sure if the 2nd issue is related or if I should open another issue.

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: win32
  Arch: x64      
  Version: Windows 10 Home
Binaries:
  Node: 20.5.0
  npm: N/A
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 14.0.5-canary.58
  eslint-config-next: 14.0.4
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.3.3
Next.js Config:
  output: N/A

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

App Router

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

Vercel (Deployed)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.locked

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions