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 refinement
Summary: Updates Relay runtime to take advantage of the new abstract type discriminator fields (`__isNode` etc). This behavior is enabled behind an off-by-default feature flag: * ResponseNormalizer no longer traverse into abstract type refinements where the response type didn't match. Previously these selections would have been flattened and we would have tried to normalize them anyway, even though the server would not have evaluated those selections. * Reader continues to try to //read// all selections. If the type is **not known to implement the interface** (the discriminator is missing or is `false`), then reset isMissingData. * Checker uses the discriminator field to decide if data is missing or not. If the type is **known to not implement the interface** (discriminator is present and `false`), then don't check the selections. Otherwise check them and don't reset recordWasMissing. The logic is that either the type does implement the interface and anything "missing" really is missing, or we don't know, and have to assume that the type does implement the interface. * ReferenceMarker is intentionally *not* updated, since it shouldn't remove any data that Reader might try to read, and Reader always tries to read data regardless of whether the types conform to abstract refinements or not. Note that this means there are situations where a component may legitimately be missing data, but we don't suspend bc we're missing the discriminator to prove definitely that data is missing. Overall this seems like the right strategy - note that checker() is more pessimistic and would consider data missing in this case. Reviewed By: jstejada Differential Revision: D21390159 fbshipit-source-id: c8b972da12133f6403c5d5ebe0470525933ef2b4
- Loading branch information
1 parent
f95b903
commit 1e0dba0
Showing
8 changed files
with
937 additions
and
24 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
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.