Next.js Discord

Discord Forum

Server side pagination w/Suspense

Answered
English Springer Spaniel posted this in #help-forum
Open in Discord
English Springer SpanielOP
Is there a way to display the suspense boundary anytime we change the route due to pagination?

I don't know if it's intended to be used this way, but I've wrapped the component that makes the request in a suspense boundary and I've created buttons that paginate through the data and update the url through the "router.replace" method. However, The suspense boundary is only displayed on first load, it's never displayed again when routing via the pagination buttons.
Answered by Ray
you could pass the searchParams as the key of suspense and it should retrigger it when the searchParams change
View full answer

3 Replies

Answer
btw, the key is a string
English Springer SpanielOP
ahhhh, now that's pretty pog :5376pepepoggerschains: . I wish they listed this somewhere in the documentation xD!

Thanks!