Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.

Commit 1709934

Browse files
authored
fix(nuxt)!: only add $f fetch prefix to auto-keys (#8852)
1 parent 1496d3a commit 1709934

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/nuxt/src/app/composables/fetch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export function useFetch<
5151
if (!request) {
5252
throw new Error('[nuxt] [useFetch] request is missing.')
5353
}
54-
const key = '$f' + _key
54+
const key = _key === autoKey ? '$f' + _key : _key
5555

5656
const _request = computed(() => {
5757
let r = request

test/basic.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ describe.skipIf(process.env.NUXT_TEST_DEV || isWindows)('payload rendering', ()
778778
it('renders a payload', async () => {
779779
const payload = await $fetch('/random/a/_payload.js', { responseType: 'text' })
780780
expect(payload).toMatch(
781-
/export default \{data:\{\$frand_a:\[[^\]]*\]\},prerenderedAt:\d*\}/
781+
/export default \{data:\{rand_a:\[[^\]]*\]\},prerenderedAt:\d*\}/
782782
)
783783
})
784784

0 commit comments

Comments
 (0)