Trigger Suspense on searchParams change using PPR #85278
Unanswered
leonardigabriele
asked this question in
Help
Replies: 2 comments 4 replies
-
|
How are you doing this exactly? import { setTimeout } from "node:timers/promises";
import { Suspense } from "react";
async function EchoSearchParams({ searchParams }: { searchParams: PageProps<'/'>['searchParams'] }) {
const search = await searchParams
await setTimeout(1000)
return (<>
<pre>{JSON.stringify(search)}</pre>
<form method="GET">
<input type="text" name="q" autoFocus />
</form>
</>)
}
export default function Home(props: PageProps<'/'>) {
return (
<>
<h1>Echo your query</h1>
<Suspense fallback={<p>Loading...</p>}>
<EchoSearchParams searchParams={props.searchParams} />
</Suspense>
</>
);
}This one outputs: Screen.Recording.2025-10-23.at.20.03.10.movI know what issue you are talking about, I had experienced it before, let's explore and investigate. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
How are you updating the url? Personally the url updates only after the server fetch without triggering the Supense, I see instead in your example the url is updating immediately. Also, I am updating the searchParams outside of the suspense boundaries, higher up in the tree. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
I am building an app where the posts archive gets filtered based on searchparams. Everything is server rendered and I wanted to implement finally PPR now that it is stable with version 16. So I am awaiting the searchParams prop only inside the posts component but by doing this I can't add them as a key to the parent Suspense as I would do before to trigger it while fetching the new data.
https://react.dev/reference/react/Suspense#resetting-suspense-boundaries-on-navigation
Is it possible to use PPR and also have Suspense triggering on navigation or I need to have the whole route dynamic?
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions