When the page changes, express doesn't work, getServerSideProps works. #15074
Unanswered
phibersoft
asked this question in
Help
Replies: 1 comment 1 reply
-
@phibersoft What are you expecting the output to look like? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi first,
I will explain my problem through an example.
I have a three components under the /pages.
/a and /b and /index
Example a :
class A extends React.Component(...render...) export async function getServerSideProps(ctx){ console.log("ServerSideProps running") }
Im using nextjs's Custom Server. (More information : https://nextjs.org/docs/advanced-features/custom-server)
example my server :
server.get("/a", async(req,res) => { console.log("Server side express running"); app.render(req,res,"/a",req.query); })
OUTPUT :
Server side express running,
ServerSideProps running
So far, no problem. But if I come back to page "b" after rendering a, then back to "a" page, the output looks like this:
OUTPUT:
Server side express running.
ServerSideProps running
// page changed /b and redirect again /a
ServerSideProps running
Is it a bug or my fault?
Beta Was this translation helpful? Give feedback.
All reactions