Replies: 8 comments 28 replies
-
Are you sure the custom fetch is the best way? |
Beta Was this translation helpful? Give feedback.
-
Hey @hnykda, have you found some solution to this problem ? Facing the same caching issue. |
Beta Was this translation helpful? Give feedback.
-
I've tried the experimental feature and it's working for me: import { unstable_noStore as noStore } from "next/cache";
export function createADMINClient() {
noStore();
return createClient(
process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.SUPABASE_SERVICE_ROLE_KEY!,
{
auth: {
autoRefreshToken: false,
persistSession: false,
},
}
);
} Now every query using this Client is getting fresh results. |
Beta Was this translation helpful? Give feedback.
-
Where is this caching behavior documented? I can't find any docs on it. Is it a supabase thing or next thing? |
Beta Was this translation helpful? Give feedback.
-
@hnykda I found a solution, for a server component simply add this: export const revalidate = 60;
// value can be 0 or any figure in seconds, it is the revalidation interval. See docs reference: https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#revalidate Or try this solution for client components https://github.com/orgs/supabase/discussions/20022#discussioncomment-9347672 |
Beta Was this translation helpful? Give feedback.
-
@hnykda Would it make sense to add a middleware solution that intercepts supabase domains? |
Beta Was this translation helpful? Give feedback.
-
I just do this
|
Beta Was this translation helpful? Give feedback.
-
Next 15 is removing its default caching 😅 |
Beta Was this translation helpful? Give feedback.
-
Hi. I simply want to stop caching of supabase-js in my nextjs app. To prevent caching now, I add a random string to the request which is terrible, e.g.:
which works, but oh boy...
I wanted to turn off caching by providing a custom fetch function that would have
cache: "no-cache"
as hinted here (and docs), but I cannot get it work typewise, as for:I get:
and also every supabase call start to complain about many other stuff I can't parse very well, like this:
What can I do?
Beta Was this translation helpful? Give feedback.
All reactions