Hey! I have a question about Nextjs caching: I have a getCachedProducts function using unstable_cache that works when it has console.logs but stops working when I remove them. The function is tagged with 'products' and gets revalidated via webhooks.
Anyone know why the console.logs affect the caching behavior?
Code snippet:
export const getCachedProducts = async (supabase: SupabaseClient) => {
return unstable_cache(
async () => {
const { data: products } = await supabase
.from('products')
.select('*, prices(*)')
.eq('active', true)
.eq('prices.active', true)
.order('metadata->index')
.order('unit_amount', { referencedTable: 'prices' })
return products as ProductWithPrices[]
},
['products-cache'],
{ tags: ['products'] }
)()
}
I'm using Nextjs 14.3