Skip to content

Conditional keepPreviousData #5866

Answered by TkDodo
guyariely asked this question in Ideas
Aug 14, 2023 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

in v5, keepPreviousData has been merged with placeholderData, mainly because you can't have both placeholderData and previousData at the same time. So I think in v5, you can achieve this with:

placeholderData: (prevData, prevQuery) => ...

it doesn't have access to the currentQuery, but you can get access to the queryKey via closures.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@guyariely
Comment options

Answer selected by guyariely
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants