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
(graphache) - Fix query traversal for previous null fields #772
Conversation
🦋 Changeset is good to goLatest commit: 70d5e2b We got this. This PR includes changesets to release 1 package
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 |
We can maybe fix the read edge case by introducing a mode on Edit: I believe the |
This properly fixes the issue where during `query` a previously resolved field that has been set to null is still being traversed.
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.
Nice 👍
Co-Authored-By: Jovi De Croock <jovi.decroock@formidable.com>
Fix #768
Summary
This issue occurs when a previous selection determined a field to be
null
. A future selection that doesn't result innull
is then forced to retrievedprevData
, but isn't covering thenull
case.This can happen with split selections on a single entity, e.g.
NullItem
fragment hitsinvalid
which causesQuery.item
to becomenull
Validitem
fragment hitsid
and tries to write it, butQuery.item
is alreadynull
This can only happen with schema awareness most of the time.
Set of changes
prevData === null
by switching most of its uses to a truthy rather than anundefined
check.prevData === null
leads to further traversalOutstanding edge cases
The read edge case can be seen in this PR's test case, when a traversal fails and returnsundefined
, then the second traversal doesn't set the affected field tonull
.