-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Update react-query depency to require at least v5.83 #10838
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
Changes from 4 commits
2064847
fa92912
7fa11ed
045a823
9c821ba
1d615df
e124713
b56aca9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,8 +57,7 @@ | |
| "react-router-dom": "^6.28.1 || ^7.1.1" | ||
| }, | ||
| "dependencies": { | ||
| "@tanstack/react-query": "^5.21.7", | ||
| "clsx": "^2.1.1", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 good catch |
||
| "@tanstack/react-query": "^5.83.0", | ||
| "date-fns": "^3.6.0", | ||
| "eventemitter3": "^5.0.1", | ||
| "inflection": "^3.0.0", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -176,7 +176,7 @@ export const useGetList = < | |
| } | ||
| : result, | ||
| [result] | ||
| ) as UseQueryResult<RecordType[], Error> & { | ||
| ) as unknown as UseQueryResult<RecordType[], Error> & { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Question: Why do we only need to do that when calling
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the record, I'd love to change that in v6 |
||
| total?: number; | ||
| pageInfo?: { | ||
| hasNextPage?: boolean; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -248,7 +248,6 @@ export type UseInfiniteGetListOptions< | |
| GetInfiniteListResult<RecordType>, | ||
| ErrorType, | ||
| InfiniteData<GetInfiniteListResult<RecordType>>, | ||
| GetInfiniteListResult<RecordType>, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does that mean that the type of
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No I believe we used it incorrectly before but it wasn't detected until this update
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's due to TanStack/query#8956. It doesn't seem to be a breaking change. |
||
| QueryKey, | ||
| number | ||
| >, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,12 @@ | ||
| import * as React from 'react'; | ||
| import { Admin, AutocompleteInput } from 'react-admin'; | ||
| import { Admin, AutocompleteInput, CardContentInner } from 'react-admin'; | ||
| import { | ||
| CustomRoutes, | ||
| Resource, | ||
| useListContext, | ||
| TestMemoryRouter, | ||
| DataProvider, | ||
| GetListParams, | ||
| } from 'ra-core'; | ||
| import fakeRestDataProvider from 'ra-data-fakerest'; | ||
| import { | ||
|
|
@@ -229,6 +230,48 @@ export const Filters = () => ( | |
| </TestMemoryRouter> | ||
| ); | ||
|
|
||
| export const ConditionalDataFetching = () => ( | ||
| <TestMemoryRouter initialEntries={['/books']}> | ||
| <Admin dataProvider={defaultDataProvider}> | ||
| <Resource | ||
| name="books" | ||
| list={() => ( | ||
| <List | ||
| filters={[<SearchInput source="q" alwaysOn />]} | ||
| empty={false} | ||
| queryOptions={{ | ||
| enabled: query => { | ||
| const params = query | ||
| .queryKey[2] as GetListParams; | ||
| return ( | ||
| params.filter.q != null && | ||
| params.filter.q !== '' | ||
| ); | ||
| }, | ||
| }} | ||
| > | ||
| <ConditionalDataFetchingView /> | ||
| </List> | ||
| )} | ||
| /> | ||
| </Admin> | ||
| </TestMemoryRouter> | ||
| ); | ||
|
|
||
| const ConditionalDataFetchingView = () => { | ||
| const context = useListContext(); | ||
|
|
||
| if (context.filterValues.q == null || context.filterValues.q === '') { | ||
| return ( | ||
| <CardContentInner> | ||
| Type a search term to fetch data | ||
| </CardContentInner> | ||
| ); | ||
| } | ||
|
|
||
| return <BookList />; | ||
| }; | ||
|
||
|
|
||
| export const Filter = () => ( | ||
| <TestMemoryRouter initialEntries={['/books']}> | ||
| <Admin dataProvider={defaultDataProvider}> | ||
|
|
||
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.
I'm not sure about where to put this documentation as it's actually
useGetListthat we configure.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.
I think it's fine here 👍