From 17099348e7b9ea926844c4144c358f82f11a0e8d Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Thu, 10 Nov 2022 09:39:49 +0100 Subject: [PATCH] fix(nuxt)!: only add `$f` fetch prefix to auto-keys (#8852) --- packages/nuxt/src/app/composables/fetch.ts | 2 +- test/basic.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nuxt/src/app/composables/fetch.ts b/packages/nuxt/src/app/composables/fetch.ts index d55d7e98dc..59d51141b3 100644 --- a/packages/nuxt/src/app/composables/fetch.ts +++ b/packages/nuxt/src/app/composables/fetch.ts @@ -51,7 +51,7 @@ export function useFetch< if (!request) { throw new Error('[nuxt] [useFetch] request is missing.') } - const key = '$f' + _key + const key = _key === autoKey ? '$f' + _key : _key const _request = computed(() => { let r = request diff --git a/test/basic.test.ts b/test/basic.test.ts index 1a79fea108..cb91e96380 100644 --- a/test/basic.test.ts +++ b/test/basic.test.ts @@ -778,7 +778,7 @@ describe.skipIf(process.env.NUXT_TEST_DEV || isWindows)('payload rendering', () it('renders a payload', async () => { const payload = await $fetch('/random/a/_payload.js', { responseType: 'text' }) expect(payload).toMatch( - /export default \{data:\{\$frand_a:\[[^\]]*\]\},prerenderedAt:\d*\}/ + /export default \{data:\{rand_a:\[[^\]]*\]\},prerenderedAt:\d*\}/ ) })