Skip to content

Commit

Permalink
feat(query-swr): cache key as const
Browse files Browse the repository at this point in the history
  • Loading branch information
anymaniax committed Mar 27, 2023
1 parent cebdb2e commit b102f54
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/query/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ const generateQueryHook = async (

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

const implementation = `${!queryKeyMutator ? queryKeyFn : ''}
Expand Down
2 changes: 1 addition & 1 deletion packages/swr/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ const generateSwrHook = (

return `export const ${swrKeyFnName} = (${queryKeyProps}) => [\`${route}\`${
queryParams ? ', ...(params ? [params]: [])' : ''
}${body.implementation ? `, ${body.implementation}` : ''}];
}${body.implementation ? `, ${body.implementation}` : ''}] as const;
${generateSwrImplementation({
operationName,
Expand Down

1 comment on commit b102f54

@vercel
Copy link

@vercel vercel bot commented on b102f54 Mar 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.