Route with/without querystring being treated as the same route
Unanswered
Brown bear posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Brown bearOP
I have a route "/search" which i have set to ISR cacheing via
export const dynamic = 'force-static';
export const revalidate = 60*60;
If i visit /search, it is cached. If i then visit /search?query=jobs, i am returned the page cache of /search. I want the route /search with unique querystrings to be treated as different routes so that each is individually cached.
export const dynamic = 'force-static';
export const revalidate = 60*60;
If i visit /search, it is cached. If i then visit /search?query=jobs, i am returned the page cache of /search. I want the route /search with unique querystrings to be treated as different routes so that each is individually cached.
6 Replies
![Avatar](https://cdn.discordapp.com/avatars/99182302885588992/a_5bba6661366313918ca006b4e4053854.gif?size=256)
Mozzy
force-static
essentially disables searchParamshttps://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#dynamic
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Brown bearOP
Oh ok, do you know the solution?
![Avatar](https://cdn.discordapp.com/avatars/99182302885588992/a_5bba6661366313918ca006b4e4053854.gif?size=256)
Mozzy
Unfortunately not, but there is some client-side caching going on with searchParams at least. Example in gif
![Image](https://cdn.discordapp.com/attachments/1142919787173920948/1142921976147619881/2023-08-20_22-43-07.gif)
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Brown bearOP
Thanks, i'll use SSR until i can find a cacheing solution
![Avatar](https://cdn.discordapp.com/avatars/484037068239142956/f386ac21405ce3442e0f3598223e1cb3.webp?size=256)
joulev
No this is not possible. You either do full dynamic rendering with the searchParams prop, or do static rendering + client side fetching with the useSearchParams hook. It’s impossible to cache different queries as different pages
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Brown bearOP
Thanks for the confirmation Joulev I won’t look into it further. I prefer to keep this feature server side so I’ll stick with dynamic