You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Setting keepPreviousData option to true does not preserve previous stale data when the query key changes but before refetch is called, as described in #419. There have been some API changes from v1 to v2 so it is possible that this is intentional but not well documented. Sample code:
const [dateRange, setDateRange] = React.useState([today, today]);
const {data, latestData, resolvedData, error, refetch, isFetching} = usePaginatedQuery(
[dateRange[0], dateRange[1]], // should not refetch when date range changes
searchFx,
{enabled: false, keepPreviousData: true} // have tried with and without keepPreviousData
);
// only search when the button is clicked
return <Button onClick={refetch}>Search</Button>
Activity
boschni commentedon Sep 12, 2020
Could you provide a codebox? Added some additional tests but cannot seem to replicate the issue: #1003
tannerlinsley commentedon Sep 18, 2020
I cannot replicate. Feel free to reopen with a codesandbox or test to illustrate the issue.