router.replace is taking too long
Unanswered
Grass Carrying Wasp posted this in #help-forum
Grass Carrying WaspOP
Hi guys, I am trying to create this debounced input component for searching. I am using the useDebouncedCallback from usehooks-ts, I also tried implementing it using setTimeout but got the same result. The result Im getting is I would see the console log much earlier than the url change, can someone please help me fix this? Thank you in advance.
5 Replies
Grass Carrying WaspOP
I tried playing with the timeout value, I even tried 50ms but the urlChange is just too slow.
just checking, do you want to just change url, or actually get new page data from nextjs server?
Grass Carrying WaspOP
the later, cause I need new filtered data after the url params is set
Chartreux
Unfortunatly that's how the pages router is working. You will need to wait for the SS props or if you don't need the data refresh you could try {shallow: true} as router options (This won't trigger SS props)