Skip to content
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

Next.js SSR Regression when using 5.0.0 instead of 4.3.0 #126

Closed
Vadorequest opened this issue Apr 3, 2020 · 4 comments
Closed

Next.js SSR Regression when using 5.0.0 instead of 4.3.0 #126

Vadorequest opened this issue Apr 3, 2020 · 4 comments

Comments

@Vadorequest
Copy link

Vadorequest commented Apr 3, 2020

I'm in the process of updating my OSS repository dependencies for https://github.com/UnlyEd/next-right-now, see PR UnlyEd/next-right-now#27.

I've noticed upgrading to [email protected], breaks SSR support.

Summary

Full detail in the PR description.

I'm likely gonna rewrite the branch history to remove [email protected] (use 4.3.0) and see how it goes from there. I've thoroughly tested deployments one by one, with small subset of dependencies updates and I'm 100% positive [email protected] breaks it, I've reproduced this behaviour locally.

@chemicalkosek
Copy link

chemicalkosek commented Apr 3, 2020

In 5.0.0, in order to have SSR you need to pass getDataFromTree (and install @apollo/react-ssr). From docs:

// import { getDataFromTree } from '@apollo/react-ssr';
// You can also override the configs for withApollo here, so if you want
// this page to have SSR (and to be a lambda) for SEO purposes and remove
// the loading state, uncomment the import at the beginning and this:
//
// export default withApollo(Index, { getDataFromTree });

Vadorequest added a commit to UnlyEd/next-right-now that referenced this issue Apr 3, 2020
…it installs @apollo/react-ssr which requires to change the current configuration - See lfades/next-with-apollo#126 (comment))
@Vadorequest
Copy link
Author

Thank you, I'll investigate.

Note that this behaviour will also be affected by updating to [email protected], because it installs @apollo/react-ssr in yarn.lock file. See https://github.com/apollographql/react-apollo/compare/[email protected]@3.1.4

I reproduced the regression locally upgrading either libraries, but on the online demo it's only affected when upgrading next-with-apollo, not when upgrading react-apollo, for some unknown reason...

Anyway, I'll follow your advice and migrate to 5.0.0 and see how it goes.

@Vadorequest
Copy link
Author

@chemicalkosek Thank you very much for your help, I managed to fix this issue. See UnlyEd/next-right-now@5f3ad97

@Vadorequest
Copy link
Author

I suggest to reference this issue for other people who'd migrate from v4 to v5 though.

Vadorequest added a commit to UnlyEd/next-right-now that referenced this issue Apr 3, 2020
* [Package] Update now to 17.1.1

* [Package] Update @emotion/core to 10.0.28

* [Package] Update 4x @FortAwesome packages

* [Package] Update @now/[email protected], @svgr/[email protected], [email protected], [email protected] packages (devDeps, non critical)

* [Package] Update  @sentry/[email protected], @sentry/[email protected] packages

* [Package] Update @types/[email protected], [email protected], [email protected], [email protected] packages (react packages)

* [Package] Update @types/[email protected], [email protected], [email protected], [email protected], [email protected] packages (jest packages + non-critical)

* [Package] Update @typescript-eslint/[email protected], @typescript-eslint/[email protected], [email protected], [email protected], [email protected] (eslint packages)

* [Package] Revert typescript from 3.8.3 to 3.7.5 - (SyntaxError: Unexpected token '.')

* [Package] Update @types/[email protected] package

* [Package] Update [email protected] package [MAJOR] (tested locally)

* [Package] Update [email protected], [email protected] packages (TS definitions)

* [Package] Revert cypress from 4.3.0 to 3.8.3 - (socket hang up)

* [Package] Revert @types/js-cookie from 2.2.5 to 2.2.4 - (socket hang up)

* Change team to avoid pricing limit...

* [Package] Update [email protected] package [MAJOR] (tested locally) + @types/js-cookie

* [Package] Update [email protected] package [MAJOR] (tested locally)

* [Package] Update [email protected], [email protected], [email protected], [email protected] packages (i18n)

* Disable Zeit alias to avoid crashing all deployments (should have thought about that sooner...)

* [Package] Update @types/[email protected] package - had to silent warnings due to bad TS defs

* Restore OSS team id

* Misc doc

* Specify for each ENV value if the mentioned value is actually valid or not

* [Package] Update [email protected] package

* [Package] Update [email protected] package (FRAMEWORK)

* [Package] Update [email protected] package (MAJOR)

* [Package] Update [email protected] package (This BREAKS SSR because it installs @apollo/react-ssr which requires to change the current configuration - See lfades/next-with-apollo#126 (comment))

* [Package] Update [email protected] package [MAJOR] + add @apollo/react-ssr and update HOC for GraphQL data fetching - See lfades/next-with-apollo#126 (comment) (tested locally and it DOES fix the SSR issue!)

* Remove duplicates <a> elements in Nav component (had forgotten a reactstrap NavLink is an actual link and not just a decorator)

* Use Next.js <Link> element properly (must embed a <a> child, not text directly, or link won't work if JS is disabled)

* Powered by header
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants