-
Notifications
You must be signed in to change notification settings - Fork 98
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
feat(develop): add refetch interval to useiceberg hook #13488
base: develop
Are you sure you want to change the base?
Conversation
desc: allow refetchInterval as prop Signed-off-by: Paul Dickerson <[email protected]>
ff5d3c4
to
f3342eb
Compare
Quality Gate passedIssues Measures |
interface IcebergV2Hook { | ||
queryKey: string[]; | ||
defaultSorting?: ColumnSort; | ||
refetchInterval?: | ||
| number | ||
| false | ||
| ((query: Query) => number | false | undefined); |
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.
interface IcebergV2Hook { | |
queryKey: string[]; | |
defaultSorting?: ColumnSort; | |
refetchInterval?: | |
| number | |
| false | |
| ((query: Query) => number | false | undefined); | |
interface IcebergV2Hook { | |
defaultSorting?: ColumnSort; | |
} extends UndefinedInitialDataInfiniteOptions<IcebergFetchResultV2<T> |
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 good If we can add all query options on params and decompose is on useInfiniteQuery
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 see what you'd like to do, but it goes beyond this issue, doesn't it?
It may have been intentional not to expose every query option on this hook, which is why I'm only requesting the refetchInterval
option, the minimum needed here.
However, an issue could certainly be opened to expose every option on icebergV2 or V6 if necessary 👍
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.
just for your information: in my experience using refreshinterval
with useInfiniteQuery
without selecting only the actual payload (in data.pages
) with select
and omitting the page params caused rerenders even if the data didn't changed after refresh (because the cursor changes even tho data is the same) so be careful about that for your use case you might need to use select
aswell. And it's even more the case with this hook since there is some state update on every data
change which should be conpletely removed
}); | ||
|
||
useEffect(() => { | ||
const flatten = data?.pages.map((page) => page.data).flat(); | ||
const flatten = data?.pages |
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.
Why not use flatMap() directly ?
desc: allow refetchInterval as prop to the useIceberg hook
Issue 13513
develop
Only FR translations have been updatedTicket reference is mentioned in linked commits (internal only)Description
Related