[Cache Components] Is Next.js's bfCache a back/forward cache? #85857
Unanswered
koichik
asked this question in
App Router
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The docs says:
Internally, this feature seems to be called bfCache. However, I believe the cache behavior differs from the browser's bfCache.
Here is the demo repository:
https://github.com/koichik/bfcache-demo
pnpm dev(orpnpm buildandpnpm start).http://localhost:3000/.Browser's bfCache
This is the back/forward cache behavior.
Next.js's bfCache
This behavior differs from the browser's bfCache.
The bfCache should be associated with history entries. In other words, the cache key should be the position of the entry in the history (e.g.
window.navigation.currentEntry.key). However, Next.js's bfCache seems to just use the URL as a key. Thus, I don't think this can be called bfCache.Do you have a plan to implement behavior similar to the browser's (i.e. real) bfCache?
Beta Was this translation helpful? Give feedback.
All reactions