-
-
Notifications
You must be signed in to change notification settings - Fork 764
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
getInitialProps is called twice #77
Comments
same issue here 😢 |
sadly I have the same issue |
So, it seems like this is not related to any Redux HOC, although it appears using the Redux HOC is causing the I'm still seeing two When submitting a bug report, it's very helpful to try and narrow it down to the simplest possible reproducible example. I'll look into this further now. Thanks for your patience everyone. |
So - I believe this was just a case of misunderstanding and copy/pasting from docs. Let me know if this is clear, and if anyone thinks something should be changed. |
@isaachinman |
So: both If I explicitly do declare a My guess is that this has to do with hoisting statics and |
I created a branch called do-not-hoist-getInitialProps which I think fixes this problem. However, I'm worried that it's also a regression and will break #11. Can a Redux user please test that branch with your |
@haoict I really doubt that's related to our codebase here, but I'd need a reproducible repo to take a look and debug further. |
Anyone get a chance to do some testing on that branch? |
I came across this issue in my project and confirmed your branch fixes it |
I know it fixes it. I'm worried about regression with #11. |
@capellini This is another issue that needs to be resolved before a prod release. Do you have any Redux/HOC projects to test with? |
@isaachinman, unforunately I don't. But in See https://codesandbox.io/s/74l24m5pnj - seems to work in this use case. |
@capellini What's this
If so, that'd be an ideal solution. |
@isaachinman |
@capellini I think your PR will not resolve this issue. |
Yes, you're right. SSR isn't working...looking more into this. |
@haoict I think I've fixed the SSR issue. Could you try again and let me know what you find? |
@capellini seems good now :D |
@capellini What was the SSR issue? Are you sure that this is safe to do? |
The issue was that, since this line was changed from: static async getInitialProps({ Component, ctx, ...initObject }) { to: static async getInitialProps(ctx) { so It is no less safe than what we were doing before. |
Hi.
As title above, I created codesandbox. Please take a look.
https://codesandbox.io/s/l2838zpq1q
The text was updated successfully, but these errors were encountered: