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: bug where query is stuck on loading if final chunk contains only hasNext: false #10735

Conversation

alessbell
Copy link
Member

Closes #10406.

The Router implemented a @defer spec proposal update in how it handles deferred responses that point to an element that was nullified in v1.6.0 that caused one of our client E2E tests that tested non-null errors thrown outside of deferred fragments to begin failing.

What was previously a final chunk of {"hasNext":false,"incremental":[{"data":null, path:...}]} now returns {"hasNext":false}, without an incremental key.

The web client was not prepared to handle final chunks containing only {hasNext: false} despite it being a valid payload, and the result is a permanent loading: true state. This fix ensures that if a chunk indicates it is the final one without any incremental data, the observable is completed.

Tested the fix with the E2E test repo:
CleanShot 2023-04-06 at 14 22 32

Checklist:

  • If this PR contains changes to the library itself (not necessary for e.g. docs updates), please include a changeset (see CONTRIBUTING.md)
  • If this PR is a new feature, please reference an issue where a consensus about the design was reached (not necessary for small changes)
  • Make sure all of the significant new logic is covered by tests

@changeset-bot
Copy link

changeset-bot bot commented Apr 6, 2023

🦋 Changeset detected

Latest commit: 30f6726

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@apollo/client Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link

netlify bot commented Apr 6, 2023

Deploy Preview for apollo-client-docs ready!

Name Link
🔨 Latest commit a58b528
🔍 Latest deploy log https://app.netlify.com/sites/apollo-client-docs/deploys/642f11242194c500080e682c
😎 Deploy Preview https://deploy-preview-10735--apollo-client-docs.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.

…k-loading' of github.com:apollographql/apollo-client into issue-10406-deferred-chunk-with-no-incremental-key-stuck-loading
@alessbell alessbell changed the title fix: bug where query is stuck on loading if final chunk contains only hasNext: false fix: bug where query is stuck on loading if final chunk contains only hasNext: false Apr 6, 2023
Copy link
Member

@jerelmiller jerelmiller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing 🙌

@alessbell alessbell merged commit 895bcdc into main Apr 6, 2023
@alessbell alessbell deleted the issue-10406-deferred-chunk-with-no-incremental-key-stuck-loading branch April 6, 2023 19:00
@github-actions github-actions bot mentioned this pull request Apr 6, 2023
@alessbell alessbell restored the issue-10406-deferred-chunk-with-no-incremental-key-stuck-loading branch April 10, 2023 19:11
@alessbell
Copy link
Member Author

/release:pr

@github-actions
Copy link
Contributor

A new release has been made for this PR. You can install it with npm i @apollo/client@0.0.0-pr-10735-20230410191152.

@alessbell alessbell deleted the issue-10406-deferred-chunk-with-no-incremental-key-stuck-loading branch April 10, 2023 19:13
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deferred query with no incremental key on incremental chunks stuck on loading
2 participants