vercel / vercel/next.js

force-no-store behaves the same as default-no-store

Open
#74,109 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
142k
Forks
32.4k
Avg merge
2d 14h
Merged PRs (30d)
351

Description

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/2r97h8

To Reproduce
  1. Create a page (using app router) with export const fetchCache = 'force-no-store'
  2. Perform some fetch with explicit force-cache
  3. Load a page
  4. Reload the page. Request is cached even though whole page should be force-no-store
Current vs. Expected behavior

I expect the fetch to not be cached, but it is actually cached if the fetch provides { cache: 'force-cache' }.

If you swap to export const fetchCache = 'force-cache' then all will be cached (including the no-store fetch request). This is what the docs say should happen (page directive takes precedence over individual fetch param). It seems to be true for force-cache, but not for force-no-store

Provide environment information
This is from the codesandbox. I have also tested this locally with 14.2.17 and 14.2.20. Broken in both.

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Sun Aug  6 20:05:33 UTC 2023
  Available memory (MB): 4102
  Available CPU cores: 2
Binaries:
  Node: 20.12.0
  npm: 10.5.0
  Yarn: 1.22.19
  pnpm: 8.15.6
Relevant Packages:
  next: 15.0.3 // There is a newer version (15.1.1) available, upgrade recommended! 
  eslint-config-next: 15.0.3
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.7.2
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)

next dev (local), next start (local)

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked CodeSandbox reproduction and the App Router handling of fetchCache, comparing force-no-store with an individual force-cache fetch. Done means a page using force-no-store does not cache that fetch, while the documented force-cache behavior remains unchanged; verify against the reported local versions.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, next.js, react
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.