-
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.
Allow getFieldValue to read from foreign Reference objects. (#5651)
The getFieldValue(fieldName) helper function was introduced in #5617 for reading fields from the current StoreObject during read functions. This commit adds a second parameter to getFieldValue, foreignRef, which is an optional Reference. When foreignRef is provided, getFieldValue will read the specified field from the StoreObject identified by the foreignRef, instead of reading from the current StoreObject. In either case, getFieldValue reads an existing value from the cache, without invoking any read functions, so you cannot use getFieldValue to set up expensive (and potentially cyclic) chains of read functions. With this new ability to read fields from arbitrary Reference objects, read functions can explore the entire reachable cache, without having to call cache.readQuery. The beauty of this system is that every field read operation requires a function call (getFieldValue), which allows the result caching system to know which fields were read from which entities, so future changes to those fields can properly invalidate any cached results that involved the original read function.
- Loading branch information
Showing
3 changed files
with
258 additions
and
6 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