You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note
It is not clearr whether this is necessary or not.
The high-order-bit is to ensure that cache + third party runtime (e.g.
apollo) makes it easy to interact with the right merged value, when the
merged value changes due to e.g. another request.
The cache returns merged entities from tx.merge(...args). These entities are not naturally going to be referentially stable, e.g. if users specify merge strategies like
asyncfunctionshallowMergeStrategy<CacheKeyRegistry>(id,{ entity, revision },current: CacheKeyValue|undefined,tx: CacheTransaction<CacheKeyRegistry>){// Object.assign to new objectreturnObject.assign({},current,entity);}
This won't matter when using Athena, since Athena needs to wrap all access in Proxys anyway in order to support field masking.
However, when using the cache with other runtime systems (e.g. apollo), it may be useful to return something referentially stable to avoid user errors where they interact with older merged objects and forget to call cache.get in e.g. component hooks.
The text was updated successfully, but these errors were encountered:
It may be that we don't have a choice and have to make the tx.merge return values referentially stable in order to make athena's DocumentProxy actually strongly reference the cache entries (and thus prevent them from being GC'd).
After all, merge is not only called after tx.commit() it will also be called later, in subsequent requests.
The cache returns merged entities from
tx.merge(...args)
. These entities are not naturally going to be referentially stable, e.g. if users specify merge strategies likeThis won't matter when using Athena, since Athena needs to wrap all access in
Proxy
s anyway in order to support field masking.However, when using the cache with other runtime systems (e.g. apollo), it may be useful to return something referentially stable to avoid user errors where they interact with older merged objects and forget to call
cache.get
in e.g. component hooks.The text was updated successfully, but these errors were encountered: