fix(nuxt)!: only add $f fetch prefix to auto-keys (#8852)

This commit is contained in:
Daniel Roe 2022-11-10 09:39:49 +01:00 committed by GitHub
parent 1496d3a07d
commit 17099348e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -51,7 +51,7 @@ export function useFetch<
if (!request) { if (!request) {
throw new Error('[nuxt] [useFetch] request is missing.') throw new Error('[nuxt] [useFetch] request is missing.')
} }
const key = '$f' + _key const key = _key === autoKey ? '$f' + _key : _key
const _request = computed(() => { const _request = computed(() => {
let r = request let r = request

View File

@ -778,7 +778,7 @@ describe.skipIf(process.env.NUXT_TEST_DEV || isWindows)('payload rendering', ()
it('renders a payload', async () => { it('renders a payload', async () => {
const payload = await $fetch('/random/a/_payload.js', { responseType: 'text' }) const payload = await $fetch('/random/a/_payload.js', { responseType: 'text' })
expect(payload).toMatch( expect(payload).toMatch(
/export default \{data:\{\$frand_a:\[[^\]]*\]\},prerenderedAt:\d*\}/ /export default \{data:\{rand_a:\[[^\]]*\]\},prerenderedAt:\d*\}/
) )
}) })