getServerSideProps runs twice with data lost [query, params] etc
See original GitHub issueWhat version of Next.js are you using?
10.0.9 - 11+
What version of Node.js are you using?
v14.16.0
What browser are you using?
Chrome, Firefox
What operating system are you using?
Windows, Mac
How are you deploying your application?
Yes
Describe the Bug
Hi there!
When we’re querying a page with getServerSideProps
with query parameters and dynamic routes (or without if prod see related issues), next call getServerSideProps
twice and on second attempt, next is loosing all data about query parameters or path params
. May be it is calling with another context second time
In my project it can be reproduced on prod only! However i’ve found good repo to reproduce https://github.com/johnruane/dynamic-route-test here you can check it even in dev
mode.
Related: https://github.com/FormidableLabs/react-progressive-image/issues/34 https://github.com/vercel/next.js/discussions/13064
Issue is critical
for my project, if you’d suggest some workaround i’ll be very thankfull!
BR Yuriy
Expected Behavior
getServerSideProps
should no be called twice or should not lost query/path parameters from it’s context
To Reproduce
clone: https://github.com/johnruane/dynamic-route-test
git clone git@github.com:johnruane/dynamic-route-test.git
cd dynamic-route-test
yarn
yarn dev
- open
chrome
:http://localhost:3000
- search something in dynamic input
that you can see log on server:
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
getServerSideProps
is called every time/dynamic/<some-value>
is called, thereact-progressive-image
component was causing a request to be done to/dynamic/undefined
sogetServerSideProps
was called.This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.