-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More precise isMissingData for abstract type refinements
Summary: == Background The earlier version of runtime abstract refinement considered the type discriminator to be optional, since we didn't originally guarantee that discriminator would be fetched. That meant that we would sometimes consider data //not// missing when it was, and not suspend when we should have. == This Diff Now that the compiler/runtime ensures type discriminator fields are always fetched and processed (see previous diff in stack), **this diff changes the runtime to consider the type discriminator to be a required field**. That is, if the discriminator itself is missing we treat that as the query/fragment having missing data (and may refetch/suspend just like we would if any other field were missing). This means that it is possible that we can have a query that //could// be fulfilled from cache except for type discriminators - e.g. there's a `... on SomeInterface { interface_field }` and we have `interface_field` in the cache but don't know whether the record implements `SomeInterface`. We may consider changing the way we handle that exact case in the future, but for now this approach is simple and predictable. == Next Up Note that there is one edge-case that is not handled yet (but is tested, see TODOs in TypeRefinement-test). The current logic is sufficient to correct set/reset `isMissing(Expected)Data` //within a single fragment//, but it doesn't work across fragment boundaries. Specifically, if we try to read a child fragment that was spread within an unmatched abstract refinement, data is not expected to be present: the parent refinement didn't match. But we don't have a way to know that presently, and incorrectly consider data for the child missing. Again, see tests with TODO. This will be addressed in a follow-up by propagating the "we're inside an unmatched refinement" information down the tree via fragment refs. Reviewed By: kassens Differential Revision: D21589446 fbshipit-source-id: 229362034c33606755989328b3d62f6bb750e4ec
- Loading branch information
1 parent
8649821
commit 08ba6f0
Showing
4 changed files
with
584 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.