Replies: 8 comments 18 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:
![image](https://private-user-images.githubusercontent.com/2741256/292875827-cde6e354-efa7-4646-b8d0-83953672f8b4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkwMTg4NDIsIm5iZiI6MTcxOTAxODU0MiwicGF0aCI6Ii8yNzQxMjU2LzI5Mjg3NTgyNy1jZGU2ZTM1NC1lZmE3LTQ2NDYtYjhkMC04Mzk1MzY3MmY4YjQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYyMiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MjJUMDEwOTAyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NTFlZWFkZDJmMTA1NTUyYTA0ZWY2NWQ5ODg0ODU4Mzk0ZmQxZTQ4OWE3YTQ2NzMxNTZhMzM2NDFiNmM3MWU4ZiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.4XK5Ct6cxdFQ6Imgk9_7qZnoNJ_BLAGpErFzwLh2NfY)
What can I do?
Beta Was this translation helpful? Give feedback.
All reactions