unstable_cache not revalidating?
Answered
Schneider’s Smooth-fronted Caima… posted this in #help-forum
Schneider’s Smooth-fronted CaimanOP
Hi
I have this setup:
Caching is working fine, however it's been 12hours and the data shown is old data *on my vercel.app domain.
Am I doing something wrong, or this is a bug?
I have this setup:
export const fetchMostPopularCities = async () => {
const supabase = await createClient();
const cachedMostPopularCities = unstable_cache(
async () => {
return await supabase.from("most_popular_cities").select("*");
},
[CACHE_TAGS.MOST_POPULAR_CITIES],
{
tags: [CACHE_TAGS.MOST_POPULAR_CITIES],
revalidate: 60 * 60 * 12, // 12 hours
},
);
const { data: mostPopularCities, error } = await cachedMostPopularCities();
if (error) {
console.error(error);
return [];
}
return mostPopularCities;
};
Caching is working fine, however it's been 12hours and the data shown is old data *on my vercel.app domain.
Am I doing something wrong, or this is a bug?
13 Replies
Schneider’s Smooth-fronted CaimanOP
Schneider’s Smooth-fronted CaimanOP
I triggered it manually and this worked. However it seems there's a bug in the revalidation config OR I don't understand how it works properly
You are using unstable cache keyparts wrong
The docs is pretty bad regarding it, I did update it to be more descriptive.. but it's still in canary, so go through it directly
Schneider’s Smooth-fronted CaimanOP
I don't immediately see how usage of keyparts is affecting the line:
revalidate: 60 * 60 * 12, // 12 hours
Which is a very good question lol, I am also wondering why lmao
@Schneider’s Smooth-fronted Caiman quick question but you went on the site to check right?
Also go debug, set a 2 min duration and test
Schneider’s Smooth-fronted CaimanOP
yes I checked the docs and youtube videos etc...
it's always my last resort to ask questions
I'll try and set a 2 min duration and come back
it's always my last resort to ask questions
I'll try and set a 2 min duration and come back
Schneider’s Smooth-fronted CaimanOP
didn't revalidate on it's own
Can you setup a minimal reproduction?
Schneider’s Smooth-fronted CaimanOP
I'll just revalidate manually for now
Answer