Remove networkMode
We recommend running this when upgrading from @suspensive/react-query
v2 & @tanstack/react-query@4
to @suspensive/react-query
v3.
In @suspensive/react-query
v3, the Suspense API has networkMode
hardcoded as 'always'
and it can no longer be modified.
For full details on the breaking changes that this codemod helps with, refer to Migrating to v3.
Terminal
npx @suspensive/codemods remove-networkmode .
This codemod safely and easily removes unnecessary networkMode
properties from Suspense API usage.
For example:
import { queryOptions } from '@tanstack/react-query'
const options = queryOptions({
queryKey: ['key'],
queryFn: () => Promise.resolve('data'),
networkMode: 'always',
})
Transforms into:
import { queryOptions } from '@tanstack/react-query'
const options = queryOptions({
queryKey: ['key'],
queryFn: () => Promise.resolve('data'),
})
Last updated on