Server-side loading after Link click
Unanswered
Australian Freshwater Crocodile posted this in #help-forum
Australian Freshwater CrocodileOP
hey guys, i have a question about Nextjs.
Im displaying a page at server-side at the url /something?page=1 , i also have a loading.tsx, and since the page makes some fetching based on the page URL param, its showing the loading correctly ✅ .
Now my problem is that my page also has a Link to /something?page=2 , and when i click it, what i was expecting is the loading.tsx to kick in again, but its not doing it. Instead its frozen for X amount of time until the fetch finishes, and then it changes the url and shows the page already loaded.
So the problem is that to the user there is no feedback at all about the button being clicked, not even the url changes to the new one. What should i do?
I tried moving the Loading to a parent folder, i tried adding the "shallow" parameter to the Link , wrapping with/without suspense, and nothing
Im displaying a page at server-side at the url /something?page=1 , i also have a loading.tsx, and since the page makes some fetching based on the page URL param, its showing the loading correctly ✅ .
Now my problem is that my page also has a Link to /something?page=2 , and when i click it, what i was expecting is the loading.tsx to kick in again, but its not doing it. Instead its frozen for X amount of time until the fetch finishes, and then it changes the url and shows the page already loaded.
So the problem is that to the user there is no feedback at all about the button being clicked, not even the url changes to the new one. What should i do?
I tried moving the Loading to a parent folder, i tried adding the "shallow" parameter to the Link , wrapping with/without suspense, and nothing
1 Reply
the loading file doesnt seem to redo for search params change (sadly), i remember hearing you can manually invoke suspense with the search param: https://github.com/vercel/next.js/issues/53543#issuecomment-1664793532