Next.js Discord

Discord Forum

Object object in a SSR getData

Answered
Common carp posted this in #help-forum
Open in Discord
Common carpOP
Hello, I have the following problem, I have a getData to get a product by id, the id comes from params. And the problem is that the getData is calling twice, and in the second call change the id (that is a number) to object object.
The url is the same http://localhost:4000/en/product/50
Answered by B33fb0n3
do you have a middleware or a redirection/router.push/anything similar in your page.js?
View full answer

10 Replies

do you have react strict mode enabled? @Common carp
Common carpOP
No, I don't, I have to?
it's enabled by default and it causes to render the app twice. That's because I am asking
Common carpOP
I change to false now in the next config but I still have the same problem
change id=50 to id %5Bobject%20Object%5D
do you have a middleware or a redirection/router.push/anything similar in your page.js?
Answer
Common carpOP
Let me check
Common carpOP
I solved, The problem was an image inside a component. Thanks for your help
great to hear! Would you please mark any of my messages as solution, even if it was only asking?
https://nextjs-forum.com/post/1181278901687812157#message-1181278909866704927
Good job! 👍