-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Description
Describe the bug
I'm trying to migrate v4 to v5 but the codemod does not seem to work for my codebase. I suspect it might be due to how my query keys are structured?
The usage in file "src/hooks/api/useQueryApi.ts" at line 1117:1117 could not be transformed into the new syntax. Please do this manually.
The usage in file "src/hooks/api/useQueryApi.ts" at line 1166:1166 could not be transformed into the new syntax. Please do this manually.
The usage in file "src/hooks/api/useQueryApi.ts" at line 1182:1182 could not be transformed into the new syntax. Please do this manually.
The usage in file "src/hooks/api/useQueryApi.ts" at line 1223:1223 could not be transformed into the new syntax. Please do this manually.
The usage in file "src/hooks/api/useQueryApi.ts" at line 1526:1526 could not be transformed into the new syntax. Please do this manually.
The usage in file "src/hooks/api/useQueryApi.ts" at line 1579:1579 could not be transformed into the new syntax. Please do this manually.
it scans the files correctly but fails to transform, anyway i could debug this? below is an example of how i typically structure my queries.
export const useQueryFunction = () => {
const queryClient = useQueryClient();
return useMutation({
mutationFn: (args) =>
mutationFunc({args...}),
async onSuccess() {
await queryClient.invalidateQueries(
GlobalQueryKeys.key1({args...})
);
},
});
};
export const GlobalQueryKeys = {
...Module1QueryKeys,
...Module2QueryKeys,
};
Does the codemod handle other changes too, like the removal of keepPreviousData: true
etc?
Your minimal, reproducible example
Steps to reproduce
- ran the following codemod on root on src.
❯ npx jscodeshift@latest ./src/ \
--extensions=ts,tsx \
--parser=tsx \
--transform=./node_modules/@tanstack/react-query/build/codemods/src/v5/remove-overloads/remove-overloads.cjs
Expected behavior
I expect everything to run successfully instead of needing manual modifications
How often does this bug happen?
None
Screenshots or Videos
No response
Platform
- macOS
Tanstack Query adapter
None
TanStack Query version
latest
TypeScript version
No response
Additional context
No response
Metadata
Metadata
Assignees
Labels
No labels