How to identify if the router is navigating in Next 14.2+ (in Client component)
Unanswered
West African Lion posted this in #help-forum
West African LionOP
Hi,
I have a client comoponent where I'm using nuqs useQueryState to update the searchParams to update the state of the page using the router. However, there is a delay between routing using nuqs searchParams and the actual data on the page being updated where I want to show a loading state, however since it's a client component ( table with react tanstack ) then I can't use a Suspense, so how do I have this behavior now?
Thanks!
I have a client comoponent where I'm using nuqs useQueryState to update the searchParams to update the state of the page using the router. However, there is a delay between routing using nuqs searchParams and the actual data on the page being updated where I want to show a loading state, however since it's a client component ( table with react tanstack ) then I can't use a Suspense, so how do I have this behavior now?
Thanks!
1 Reply
Brown bear
If your update is using
https://nuqs.47ng.com/docs/options#transitions
shallow: false to update the server, you could try the startTransition option, the loading state corresponds to when the RSC request is on flight:https://nuqs.47ng.com/docs/options#transitions