-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Avoid adding QueryPromise when skip is true on SSR #7310
Avoid adding QueryPromise when skip is true on SSR #7310
Conversation
@izumin5210: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/ |
Signed ✅ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@izumin5210 This makes sense to me, and thanks for adding a regression test. Sorry to keep you waiting!
eaa2886
to
4b9145a
Compare
PR apollographql#7310 introduced a regression that caused skipped SSR queries to always set `loading` to `true`, which doesn't match the behavior of `useQuery()` on the client and can result in hydration mismatches. The problem is that `skip: true` was being treated as equivalent to `ssr: false`, but they're not actually equivalent. I think the correct solution is to let `this.getQueryResult()` provide a suitable result when `skip` is truthy, which ensures that skipped SSR queries will get the same result as skipped non-SSR queries. Fixes apollographql#7380
PR #7310 introduced a regression that caused skipped SSR queries to always set `loading` to `true`, which doesn't match the behavior of `useQuery()` on the client and can result in hydration mismatches. The problem is that `skip: true` was being treated as equivalent to `ssr: false`, but they're not actually equivalent. I think the correct solution is to let `this.getQueryResult()` provide a suitable result when `skip` is truthy, which ensures that skipped SSR queries will get the same result as skipped non-SSR queries. Fixes #7380 Co-authored-by: Ben Newman <[email protected]>
Fixing #6342
When
skip
is set to true on SSR,useQuery
skips a network request. But firingrenderToString
.Checklist:
only small bugfix