Hello there
Still a bit new to nuxt3.
I have this composable that fetch a "config" object, containing several parameters used all over the app.
The add returns something like that :
{
"seo":{...},
"analytics":{...},
...
}
The composable is really simple :
export default async function(key = null) {
const url = `/api/config`;
const { data } = await useAsyncData(`fetch_config`, () => $fetch(url));
return key !== null ? ref(data.value[key]):data;
}
And I use it in components, pages, nav etc...
Here let say here in cookie banner
const analytics = await useAPIConfig('analytics');
The problem i'm facing is that I have as much request as I use my composable. I'm not even sure I'm getting the payload from the SSR. I though it was suppose to be deduplicated, but I think I misunderstood how it's suppose to work.
Obviously, the config does need to be loaded once.
What am I missing ?