Update query param without page reload
Unanswered
Yacare Caiman posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Yacare CaimanOP
https://stackblitz.com/edit/stackblitz-starters-pgnz3c?file=app%2Fpaginator%2Fpaginator.tsx&view=editor
So in the repo above I basically have...
-> an api route that sleeps for 2s before returning data
-> a
-> and buttons that update the query params
When a button is clicked the url is updated immediately but the ui isnt updated until after 2s
-> the
-> nor is the
I've tried using
Any ideas where I'm going wrong?
So in the repo above I basically have...
-> an api route that sleeps for 2s before returning data
-> a
<Paginator />
component that fetches data based on the query params (using react-query)-> and buttons that update the query params
When a button is clicked the url is updated immediately but the ui isnt updated until after 2s
-> the
<Suspense />
fallback in page.tsx isnt displayed-> nor is the
isLoading
flag updated by the useQuery hookI've tried using
router.push
, router.replace
, window.history.pushState
but none of these seem to trigger the suspense / loading stuffAny ideas where I'm going wrong?
4 Replies
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Yacare CaimanOP
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Yacare CaimanOP
Looks like I can at least detect the loading state by wrapping the button handlers in
but still wondering if theres a way to get Suspense /
useTransition()
but still wondering if theres a way to get Suspense /
useQuery().isLoading
to work![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
Greater Scaup
Did you manage to solve this?
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
Greater Scaup
🙁