Open roxizhauk opened 9 months ago
Having the same issue but with fetch cache
Same issue.
Edit by maintainer bot: Comment was automatically minimized because it was considered unhelpful. (If you think this was by mistake, let us know). Please only comment if it adds context to the issue. If you want to express that you have the same problem, use the upvote 👍 on the issue description or subscribe to the issue for updates. Thanks!
Wrapping the function with React's cache
didn't solve the issue nor did disabling Strict Mode.
This seems to happen not just to unstable_cache
. I've found similar issues but no solution.
I also face the same issue as described above and it seems to be evident in the latest version of next (14.2.5), following for updates.
I don't think the bug is in unstable_cache
but tather on build process of next.js
There was a bad implementation of the generating static pages during bulids, renderToReadableStream
used to be called twice during the build. which might have caused your problem. Zack addressed this in #67680. You can test the reproduction with version v15.0.0-canary.70 or higher to see if the problem persists
@AhmedBaset is this fix going to be released for v14?
is this fix going to be released for v14?
@federicodelpiano
I don't know. Have you tested the issue with v15.0.0-canary.70? If it's fixed you might want to ping @ztanner
to ask whether they will release it in a backport release as they do lately
Link to the code that reproduces this issue
https://github.com/roxizhauk/test-unstable-cache
To Reproduce
git push
to deploy on VercelgetWords()
is executed twice on PlanetScale every buildCurrent vs. Expected behavior
The data cached by
unstable_cache
is updated every build on Vercel, querying to the database on PlanetScale TWICE.This
getWords()
is used in a static page ("/").The following log shows how the fetch works on development.
In local build, it still fetches twice in the initial build but the cache seems not updated in another build (becasue the query wouldn't be fired in PlanetScale). Also, the same function used in a route handler only fetches once every build.
I expect the cache to be persistent across deployments as Data Cache does, and
unstable_cache
to fetch only once if another request isn't intended.Provide environment information
Which area(s) are affected? (Select all that apply)
Data fetching (gS(S)P, getInitialProps)
Which stage(s) are affected? (Select all that apply)
Vercel (Deployed)
Additional context
Tested through "14.1.0".