-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
placeholderData
codemod
#6196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
placeholderData
codemod
#6196
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit a1ff22b:
|
☁️ Nx Cloud ReportCI is running/has finished running commands for commit a1ff22b. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
packages/codemods/src/v5/keep-previous-data/__testfixtures__/default.input.tsx
Outdated
Show resolved
Hide resolved
packages/codemods/src/v5/keep-previous-data/__testfixtures__/default.input.tsx
Show resolved
Hide resolved
…ion examples It was a request by @TkDodo, since in `v4` the `placeholderData` function didn't have a parameter. For further details see: TanStack#6196 (comment)
…s not a function It was a request by @TkDodo, see: TanStack#6196 (comment)
…a` has value `true`
… into feat/keep-previous-data-codemod
@TkDodo please review the contents of the Shall I mention somewhere it's designed to work with only object expressions? |
packages/codemods/src/v5/keep-previous-data/__testfixtures__/default.input.tsx
Show resolved
Hide resolved
@@ -0,0 +1,90 @@ | |||
import * as React from 'react' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TkDodo please review the output of the codemod.
const { isKeepPreviousDataInUse } = transformUsages({ | ||
...dependencies, | ||
config: { | ||
hooks: ['useInfiniteQuery', 'useQueries', 'useQuery'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TkDodo other hooks might be affected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops I missed this comment. We also have the global defaults like:
new QueryClient({
defaultOptions: {
queries: {
keepPreviousData: true
}
}
})
and:
queryClient.setQueryDefaults(['key'], {
keepPreviousData: true
})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't worry, I will open another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Covered by:
We're currently processing your upload. This comment will be updated when the results are available. |
…ryClient` instance with the codemod For further details see: TanStack#6196 (comment)
…codemod For further details see: TanStack#6196 (comment)
* chore(codemod): add named examples to the `keep-previous-data` codemod, because these were missing * chore(codemod): remove the unnecessary `return` statement * feat(codemod): cover the `setQueryDefaults` method usages on the `QueryClient` instance with the codemod For further details see: #6196 (comment) * chore(codemod): rename the `isKeepPreviousDataInUse` to `shouldAddKeepPreviousDataImport` The new name describes better the purpose of this variable. * feat(codemod): cover the `QueryClient` class instantiations with the codemod For further details see: #6196 (comment) * chore(codemod): fix `eslint` issues within the `keep-previous-data` codemod * chore(codemod): fix the `prettier` issues within the `keep-previous-data` codemod README file * chore(codemod): turn off the `sort-imports` ESLint rule in case of the codemods Since the codemods might not respect the import order, it's easier to turn off the `sort-imports` ESLint rule. --------- Co-authored-by: Dominik Dorfmeister <[email protected]>
Closes #5760