-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: upgrade to use @tanstack/react-query@v5
- Loading branch information
Showing
9 changed files
with
1,973 additions
and
1,770 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
This document provides instructions for upgrading between major | ||
versions of `@lifeomic/one-query` | ||
|
||
### 3.x -> 4.x | ||
|
||
- Replace your installation of `@tanstack/[email protected]` with `@tanstack/[email protected]` | ||
|
||
- See `react-query`'s [migration guide](https://tanstack.com/query/v5/docs/framework/react/guides/migrating-to-v5) for an idea. The largest changes will be outlined below - however since `one-query` is mostly a typed wrapper around `react-query` most, if not all, things mentioned apply | ||
|
||
- The `loading` status has been renamed to `pending`, and similarly the derived `isLoading` flag has been renamed to `isPending` | ||
|
||
```diff | ||
- query.status === 'loading' | ||
+ query.status === 'pending' | ||
|
||
- if (query.isLoading) | ||
+ if (query.isPending) | ||
``` | ||
|
||
- `useInfiniteAPIQuery` now requires `initialPageParam` and `getNextPageParam` options. Passing page param through `fetchNextPage` and `fetchPreviousPage` is no longer supported. | ||
|
||
```diff | ||
- const query = useInfiniteAPIQuery('GET /list', { | ||
- filter: 'some-filter', | ||
- after: undefined, | ||
- }); | ||
- await void query.fetchNextPage({ pageParam: {...} }); | ||
+ const query = useInfiniteAPIQuery( | ||
+ 'GET /list', | ||
+ { | ||
+ filter: 'some-filter', | ||
+ after: undefined, | ||
+ }, | ||
+ { | ||
+ initialPageParam: {}, | ||
+ getNextPageParam: (lastPage) => ({ | ||
+ after: lastPage.next, | ||
+ }), | ||
+ }, | ||
+ ); | ||
+ await void query.fetchNextPage(); | ||
``` | ||
|
||
- The minimum required TypeScript version is now 4.7 | ||
|
||
- TypeScript: `Error` is now the default type for errors instead of `unknown` | ||
|
||
- Callbacks on `useQuery` have been removed (e.g., `onSuccess`, `onError` and `onSettled`) | ||
|
||
- Removed `keepPreviousData` in favor of `placeholderData` identity function | ||
|
||
- Rename `cacheTime` to `gcTime` | ||
|
||
- Removed `refetchPage` in favor of `maxPages` | ||
|
||
- The experimental `suspense: boolean` flag on the query hooks has been removed - new hooks for suspense have been added |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.