-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use getSearchParams() without force-dynamic for draft mode requests ? #39
Comments
Hello! Thanks for the issue, this is a really interesting and important point. Apparently next.js removes some params specifically for Vercel 😬 As an option, I can suggest adding a url header to the middleware and extract params from it, taking it from headers (vercel/next.js#43704 (comment)) In any case, I’ll try to dig deeper and maybe to figure it out |
Well. After researching decided to mark this getter as deprecated. There are too many situations where next.js already trims or may trim params. Instead, it will be recommended to use a solution via middleware and get-page-config (as written here). Thanks again for writing about the problem! |
Hey @vordgi , thanks for the speedy response and action! Interesting that NextJS removes those params. Thanks for the middleware suggestion, that was very helpful. I've got it working now, I didn't realise that middleware doesn't necessarily opt you in to dynamic rendering for a page so that does the job perfectly for me. Thanks! |
Hi there,
I'm not using
export const dynamic = 'force-dynamic'
as I'm trying to use static rendering where possible, I understand though that unlikegetPathname()
,getSearchParams()
requires dynamic rendering as the search params can only be known at request time, not build time.However I wondered if it's still possible to use it in draft mode, which is rendered at request time, eg.
This does work locally, but not on a preview deployment on Vercel.
Is this possible? Or am I missing something
Thanks!
The text was updated successfully, but these errors were encountered: