Skip to content

Commit b102f54

Browse files
committedMar 27, 2023
feat(query-swr): cache key as const
1 parent cebdb2e commit b102f54

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed
 

‎packages/query/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ const generateQueryHook = async (
906906

907907
const queryKeyFn = `export const ${queryKeyFnName} = (${queryKeyProps}) => [\`${route}\`${
908908
queryParams ? ', ...(params ? [params]: [])' : ''
909-
}${body.implementation ? `, ${body.implementation}` : ''}];`;
909+
}${body.implementation ? `, ${body.implementation}` : ''}] as const;`;
910910

911911
const implementation = `${!queryKeyMutator ? queryKeyFn : ''}
912912

‎packages/swr/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ const generateSwrHook = (
323323

324324
return `export const ${swrKeyFnName} = (${queryKeyProps}) => [\`${route}\`${
325325
queryParams ? ', ...(params ? [params]: [])' : ''
326-
}${body.implementation ? `, ${body.implementation}` : ''}];
326+
}${body.implementation ? `, ${body.implementation}` : ''}] as const;
327327
328328
${generateSwrImplementation({
329329
operationName,

1 commit comments

Comments
 (1)

vercel[bot] commented on Mar 27, 2023

@vercel[bot]
Please sign in to comment.