segmentio / evergreen

🌲 Evergreen React UI Framework by Segment
https://evergreen.segment.com
MIT License
12.39k stars 832 forks source link

fix(example)Next JS _document error #1490

Closed TIMMLOPK closed 2 years ago

TIMMLOPK commented 2 years ago

Overview If using nextjs =>12.1.6 , may get error: "MyDocument.getInitialProps()" should resolve to an object with a "html" prop set with a valid html string

Documentation

netlify[bot] commented 2 years ago

Deploy Preview for evergreen-storybook ready!

Name Link
Latest commit 911f495772f2f3033cc544703e0d2bf5738640dc
Latest deploy log https://app.netlify.com/sites/evergreen-storybook/deploys/62bbdbff1ec75800084fe8c8
Deploy Preview https://deploy-preview-1490--evergreen-storybook.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

cogwizzle commented 2 years ago

Would this break any existing functionality? I can see that the current version supports the logic that you recommended but I am just curious if it would break existing codebases that haven't updated to 12.x yet. I can't find older documentation, but here is some documentation from NEXT supporting @TIMMLOPK's change. https://nextjs.org/docs/advanced-features/custom-document#customizing-renderpage

brandongregoryscott commented 2 years ago

@TIMMLOPK Did you mean v12.2+? I don't think NextJS has a v12.6 out yet: https://www.npmjs.com/package/next

In either case, I'm not sure I'm able to reproduce this. Can you provide a CodeSandbox for reproduction?

TIMMLOPK commented 2 years ago

@TIMMLOPK Did you mean v12.2+? I don't think NextJS has a v12.6 out yet: https://www.npmjs.com/package/next

In either case, I'm not sure I'm able to reproduce this. Can you provide a CodeSandbox for reproduction?

It is 12.1.6,I correct it.I would try to make reproduction

TIMMLOPK commented 2 years ago

@brandongregoryscott seem can't make it in codesandbox because it crash.I made a repo for it :https://github.com/TIMMLOPK/error-reproduction

TIMMLOPK commented 2 years ago

Would this break any existing functionality? I can see that the current version supports the logic that you recommended but I am just curious if it would break existing codebases that haven't updated to 12.x yet. I can't find older documentation, but here is some documentation from NEXT supporting @TIMMLOPK's change. https://nextjs.org/docs/advanced-features/custom-document#customizing-renderpage

No , I tried to use 11.x ,it doesn't matter

brandongregoryscott commented 2 years ago

Ah, ok. I see the issue in my console using that version (and again when I updated to 12.2.0 - not sure why I wasn't seeing it before, perhaps it wasn't actually running the latest version)

This change seems to work in the version we have specified in the package.json too (12.1.0), so I think this is fine to update. Thanks!