-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide default empty StoreObject for root IDs like ROOT_QUERY. (#7100)
This change means the existence of root objects like ROOT_QUERY and ROOT_MUTATION will no longer depend on whether other queries/mutations have previously written data into the cache. This matters because (until just recently) cache.read would return null for a completely missing ROOT_QUERY object, but throw missing field errors if ROOT_QUERY existed but did not have the requested fields. In other words, this commit hides the difference between the absence of ROOT_QUERY and its incompleteness, so unrelated cache writes can no longer unexpectedly influence the null-returning vs. exception-throwing behavior of cache.read. As an additional motivation, with AC3 field policies, it's possible now to define synthetic root query fields that have a chance of returning useful values even if the cache is completely empty. Providing a default empty object for root IDs like ROOT_QUERY is important to let those read functions be called, instead of prematurely returning null from cache.read when ROOT_QUERY does not exist. Note: this PR builds on PR #7098.
- Loading branch information
Showing
3 changed files
with
67 additions
and
2 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