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

Fix fetching apolloState on SSR #323

Merged
merged 2 commits into from
Jun 19, 2020
Merged

Fix fetching apolloState on SSR #323

merged 2 commits into from
Jun 19, 2020

Conversation

iquabius
Copy link
Owner

@iquabius iquabius commented Jun 19, 2020

Problem found in #315:

image

This integration was very old. So I refactored it to reflect the last version of with-apollo-auth example in Next.js' repository.

  • Move Apollo's HOC and initialization logic into one file: web/src/utils/apollo.tsx
  • Convert Class to Function component
  • Add types to withApollo() and the other functions

@iquabius
Copy link
Owner Author

It's still rendering the loading state in SSR, but all the apolloState is being passed correctly now:

image

The problem with the loading state is because of the beta versions of @apollo/* we're using:

apollographql/react-apollo#3678 (comment)

@codecov-commenter
Copy link

codecov-commenter commented Jun 19, 2020

Codecov Report

Merging #323 into master will decrease coverage by 0.11%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #323      +/-   ##
==========================================
- Coverage   23.43%   23.31%   -0.12%     
==========================================
  Files         106      105       -1     
  Lines        1434     1437       +3     
  Branches      230      229       -1     
==========================================
- Hits          336      335       -1     
- Misses       1097     1102       +5     
+ Partials        1        0       -1     
Impacted Files Coverage Δ
packages/web/src/pages/_app.tsx 0.00% <ø> (ø)
packages/web/src/utils/apollo.tsx 0.00% <0.00%> (ø)
packages/web/src/utils/helpers.ts 23.07% <ø> (-3.59%) ⬇️
packages/web/src/components/ThemeContext.tsx 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update df16c8e...82eeb89. Read the comment docs.

@iquabius iquabius changed the title Update Apollo Integration using with-apollo-auth example Fix fetching apolloState on SSR Jun 19, 2020
@iquabius iquabius merged commit f9ee23a into master Jun 19, 2020
@iquabius iquabius deleted the ApolloClientIntegration branch June 19, 2020 18:53
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

Successfully merging this pull request may close these issues.

None yet

2 participants