boraxpr / nuxtjs-supabase

https://nuxtjs-supabase.vercel.app
2 stars 1 forks source link

[Caching] Implementation of Data Caching on Pages #45

Open boraxpr opened 7 months ago

boraxpr commented 7 months ago

https://nuxt.com/docs/getting-started/data-fetching#useasyncdata

<script setup>
const { data, error } = await useAsyncData('customers', () => myGetFunction('users'))
</script>

Here in the example 'customers' is a caching key image When data is cached it will appear on Nuxt DevTools > Payload Tab > Data keyed state

On cache invalidates, supabase js client will be initiated on client-side. On cache hit, cache is on the server. Hence, Supabase js client would not be initiated.