All files / apps/huella-legal/app/composables useCachedFetch.ts

100% Statements 2/2
100% Branches 6/6
100% Functions 1/1
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8  38x   70x        
// Nuxt's default reuses fetched data only while hydrating or from a loaded `_payload.json`
export const useCachedFetch = createUseFetch({
    getCachedData: (key, nuxtApp, { cause }) =>
        cause === "refresh:manual" || cause === "refresh:hook"
            ? undefined
            : ((nuxtApp.payload.data[key] ?? nuxtApp.static.data[key]) as unknown),
});