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

Prevent occasional error of SubSelectionRequired #2001

Open
vicary opened this issue Aug 22, 2024 · 0 comments
Open

Prevent occasional error of SubSelectionRequired #2001

vicary opened this issue Aug 22, 2024 · 0 comments

Comments

@vicary
Copy link
Member

vicary commented Aug 22, 2024

Summary

For GraphQL fields that allows sub-selections, where the cache contains an empty array, or nulls for nullable object fields, it may block the proxy from capturing selections further down the tree.

A previous attempt #1757 reduces the effect, but it doesn't not prevent the issue in use cases with multiple concurrent fetches.

Steps to reproduce

These are user reported scenarios:

  1. resolve() on paginated queries may trigger this after one of the result set contains a null object under an array.
  2. useQuery() in React may fail when a new fetch is triggered during an active fetch, where the response of the first fetch clears selections before the second one has a chance to cache it.
  3. createQuery() in Solid includes an attempt to fix this, but it triggers another issue where the last promise fails to resolve, locking the UI in a loading/suspended state.

Expected Results

When new fetches are triggered,

  1. responses from previous fetches should update the cache
  2. responses from previous fetches should not trigger cache listeners
  3. responses from previous fetches should not trigger the onNext callback in subscribe
  4. response of the last fetch should update the cache, notify cache listeners and trigger UI updates downstream.

Additional Information

#1758 will attempt to cover racing condition on cache updates and selection clearing for concurrent fetches.

@vicary vicary mentioned this issue Aug 22, 2024
8 tasks
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

1 participant