-
Notifications
You must be signed in to change notification settings - Fork 27.2k
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
clarify possible getServerSideProps
return values
#33576
Comments
The type basically says Any thoughts? Else, I will raise a PR regarding it. |
…based on the declared type (fix vercel#33576)
Yes, the correct way is to return either of those. The wording in the docs is a bit ambiguous. It doesn't make sense to use them together, neither does it to only return Feel free to open a PR to address this. |
Hi, Can I work on this issue? If still open? |
I have raised a PR here |
getServerSideProps
return values
getServerSideProps
return valuesgetServerSideProps
return values
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
What is the improvement or update you wish to see?
I would like to clarify the API documentation for the return value of
getServerSideProps
.Is there any context that might help us understand?
I was implementing user authentication on my website, and I was trying to restrict access to the login and signup pages if the user is logged in. To do so, I am implementing this
getServerSideProps
to redirect the user if they're logged in:If I return an empty object (
{}
), next gives me this error:I used an empty object because in the documentation, it is mentioned that that the
props
argument is optional. I later realised that maybe the content for theprops
property is optional, but not the object itself, and I was just proposing to clarify this for other people in the future.Does the docs page already exist? Please link to it.
https://nextjs.org/docs/api-reference/data-fetching/get-server-side-props
The text was updated successfully, but these errors were encountered: