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
Values fetched under one setting are not propagated into cache entries for another setting. This prevents derived properties from leaking into variants where they were not requested.
Optimistic updates
Optimistic value updates are intentionally not propagated between different ontology-defined-derived-property settings.
The existing optimistic-update path writes through the server-default cache variant. Consequently, hooks using an explicit true or false setting will display the updated server value after the action completes and the query is refreshed, rather than displaying the optimistic value.
This could lead to some times when the UI is out of sync, but it will always later reconsolidate. An alternative to this approach is allow optimistic writes to update all three variants, but this will cause the OTDP values to be temporarily inconsistent during an optimistic update.
Testing
Added coverage for:
Forwarding explicit false through each React hook
Separating bulk requests by OTDP setting
Partitioning object, list, object-set, and link cache entries
Preventing fetched and optimistic values from crossing OTDP cache variants
The main thing I'm concerned about is the optimistic writes. We could go through and refactor optimistic updates to not have temporary inconsistencies (either UI or in the cache), but that would be a more involved change. I'm not sure how many use cases of the React OSDK load the same object twice, one with OTDPs and one without, so this may not even matter much.
The main thing I'm concerned about is the optimistic writes. We could go through and refactor optimistic updates to not have temporary inconsistencies (either UI or in the cache), but that would be a more involved change. I'm not sure how many use cases of the React OSDK load the same object twice, one with OTDPs and one without, so this may not even matter much.
If it's not used much, may be better to just have a cache inconsistency than a UI inconsistency because the UI one will show up if they use the flag at all, but the cache one only shows up if you load an object both with and without OTDPS
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
$UNSTABLE_loadOntologyDefinedDerivedPropertiessupport to the React OSDK hooks and corresponding observable-client APIs:useOsdkObjectuseOsdkObjectsuseObjectSetuseLinksThe option is forwarded through object, list, object-set, link, pagination, batching, and interface-to-object reload paths.
Cache behavior
The cache treates each setting as a distinct variant:
undefined: use the server defaultfalse: explicitly disable ontology-defined derived propertiestrue: explicitly enable ontology-defined derived propertiesValues fetched under one setting are not propagated into cache entries for another setting. This prevents derived properties from leaking into variants where they were not requested.
Optimistic updates
Optimistic value updates are intentionally not propagated between different ontology-defined-derived-property settings.
The existing optimistic-update path writes through the server-default cache variant. Consequently, hooks using an explicit
trueorfalsesetting will display the updated server value after the action completes and the query is refreshed, rather than displaying the optimistic value.This could lead to some times when the UI is out of sync, but it will always later reconsolidate. An alternative to this approach is allow optimistic writes to update all three variants, but this will cause the OTDP values to be temporarily inconsistent during an optimistic update.
Testing
Added coverage for:
falsethrough each React hookAlso tested e2e locally