Revalidate prisma query in `page.ts` RSC
I'm getting the same data every time I visit this route.
Is there a way to revalidate prisma queries in a RSC?
22 Replies
try add
export const revalidate = 0;
the explanation for it
0: Ensure a layout or page is always dynamically rendered even if no dynamic functions or dynamic data fetches are discovered. This option changes the default of fetch requests that do not set a cache option to 'no-store' but leaves fetch requests that opt into 'force-cache' or use a positive revalidate as is.The problem is
revalidate
and all the other functions like revalidatePath
and revalidateTags
all seem to work only for the fetch
implementation next team made, not for prisma
@nyx (Rustular DevRel) Tried it anyway, nothing changes
The only way I don't get staled data is by doing full page reload which, I mean, it definitely sucks... the whole point of RSC is not to make a backend, isn't it? I feel like I need a backend right nowdoes
export const dynamic = "force-dynamic"
help?No @n1xx1
So my question is: is it possible to revalidate anything other than
fetch()
functions?
I asked in the Nextjs discord and nobody seems interested in answering that questionI mean, it's supposed to work like you expect. I'm not sure what's going on
it should be able
I'll work on a code sandbox
next dedupe fetch requests
but i know that it will cache pages in general
also it's a page with params, it's dynamic by default, it's not supposed to cache anything. try to reproduce in the codesandbox, maybe it's helpful!
also make sure you're on next 13.4 I guess, I remember some issues with dev mode page caching
I'm on it
@nyx (Rustular DevRel) @n1xx1
https://codesandbox.io/p/sandbox/gifted-microservice-fphtss?file=%2Fapp%2Fadd%2Fadd-form.tsx
gifted-microservice-fphtss
CodeSandbox is an online editor tailored for web applications.
Add and modify a post in that codesandbox please
If you try to modify the second time, you'll get staled data
if i modify the code
it creates a new sandbox for me
add this on page.tsx
add that to the root page
on
/app/page.tsx
I added that and doesn't help bro
Bro, I feel like a beta tester, app router is stable, isn't it? How is this not working?
is not stable
it never was
The docs says is stable, they lie to us?
ok I see what's going on, the data is changing but react-hook-form won't update your default variables
Why not? it's unmounted everytime we use it
react-hook-form can't persist data, as far as I can see
will purge the page
and refresh accordingly
Yeah, that might work (workaround), just I was expecting
revalidatePath()
to do what the name of the function suggests
It's kinda disheartening to feel like nobody has thought of this simple issue, are these features getting adopted or is it just me?
moment of sadness I guess I never tried without doing a full refresh B)
Next team is working on this issue:
https://github.com/vercel/next.js/issues/49496#issuecomment-1540135469
GitHub
Revalidate anything other than
fetch()
· Issue #49496 · vercel/ne...Verify canary release I verified that the issue exists in the latest Next.js canary release Provide environment information Operating System: Platform: linux Arch: x64 Version: #22 SMP Tue Jan 10 1...