Skip to content

Best practice? Filtering logic with useSuspenseQuery + react-router v7 useSearchParams #8463

Closed Answered by TkDodo
vaziliybober asked this question in Q&A
Discussion options

You must be logged in to vote

But navigation is a transition now in react-router v7. So the value of searchParams from react-router is actually deferred. This is good for keeping the previous data on the screen. But this is bad for showing the filters that are just submitted. How do I show them?

Not sure what this has do to with react-query? How would that work if you suspend e.g. with use in React 19? I think this is a question that you have to ask the react-router maintainers.

I think it’s just one trade-off in one way or the other. With TanStack router, you would need to call useDeferredValue(searchParams) manually to opt-into transitions, then pass that value to useQuery. So transitions are more opt-in.

Replies: 1 comment 1 reply

Comment options

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

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