Skip to content

Add OTDP Flag to React hooks - #4019

Open
williamhe723 wants to merge 8 commits into
mainfrom
wh/react-otdp-hooks
Open

williamhe723 wants to merge 8 commits into
mainfrom
wh/react-otdp-hooks

Conversation

@williamhe723

@williamhe723 williamhe723 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds $UNSTABLE_loadOntologyDefinedDerivedProperties support to the React OSDK hooks and corresponding observable-client APIs:

  • useOsdkObject
  • useOsdkObjects
  • useObjectSet
  • useLinks

The 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 default
  • false: explicitly disable ontology-defined derived properties
  • true: explicitly enable ontology-defined derived properties

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

Also tested e2e locally

github-actions Bot added a commit that referenced this pull request Sep 10, 2026
@github-actions

github-actions Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Storybook Preview

📚 Open Storybook preview

Built from commit 050b74d.
Workflow run

@github-actions

github-actions Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size Change
@osdk/api 432 B 0%
@osdk/client 31.05 kB +0.09% 🔺
@osdk/client/experimental 31.71 kB 0%
@osdk/client/observable 58.30 kB +0.40% 🔺
@osdk/oauth 6.54 kB 0%
@osdk/react 62.17 kB +0.30% 🔺
@osdk/react/devtools-registry 184 B 0%
@osdk/react/experimental 62.27 kB +0.46% 🔺
@osdk/react/platform-apis 4.07 kB 0%
@osdk/react/testing 536 B 0%
@osdk/react/experimental/admin 4.07 kB 0%
@osdk/react/experimental/aip 5.21 kB 0%
@osdk/react-components 10 B 0%
@osdk/react-components/action-form 277.63 kB +0.07% 🔺
@osdk/react-components/document-viewer 346.76 kB -0.02% 🔽
@osdk/react-components/email-viewer 21.89 kB +0.04% 🔺
@osdk/react-components/experimental 707.78 kB +0.08% 🔺
@osdk/react-components/filter-list 132.06 kB -0.13% 🔽
@osdk/react-components/image-viewer 3.72 kB +0.13% 🔺
@osdk/react-components/markdown-viewer 44.26 kB 0%
@osdk/react-components/object-table 162.70 kB +0.11% 🔺
@osdk/react-components/pdf-viewer 160.33 kB 0%
@osdk/react-components/primitives 40.64 kB 0%
@osdk/react-components/spreadsheet-viewer 106.21 kB -0.02% 🔽
@osdk/react-components/tiff-viewer 29.63 kB -0.13% 🔽
@osdk/react-components/video-viewer 3.76 kB +0.44% 🔺
@osdk/react-components/xml-viewer 3.74 kB +0.34% 🔺
@osdk/react-components/experimental/action-form 277.38 kB -0.07% 🔽
@osdk/react-components/experimental/aip-agent-chat 16.45 kB 0%
@osdk/react-components/experimental/cbac-picker 54.20 kB -0.01% 🔽
@osdk/react-components/experimental/document-viewer 346.66 kB -0.01% 🔽
@osdk/react-components/experimental/email-viewer 21.89 kB +0.03% 🔺
@osdk/react-components/experimental/filter-list 132.14 kB +0.06% 🔺
@osdk/react-components/experimental/image-viewer 3.74 kB +0.05% 🔺
@osdk/react-components/experimental/markdown-renderer 44.30 kB 0%
@osdk/react-components/experimental/object-table 162.79 kB +0.08% 🔺
@osdk/react-components/experimental/pdf-viewer 160.40 kB +0.03% 🔺
@osdk/react-components/experimental/spreadsheet-viewer 106.19 kB +0.07% 🔺
@osdk/react-components/experimental/theme 714 B 0%
@osdk/react-components/experimental/tiff-renderer 29.72 kB +0.25% 🔺
@osdk/react-components/experimental/video-viewer 3.76 kB 0%
@osdk/react-components/experimental/xml-viewer 3.74 kB 0%
@osdk/widget.client-react 12.57 kB +0.24% 🔺

github-actions Bot added a commit that referenced this pull request Sep 10, 2026
github-actions Bot added a commit that referenced this pull request Sep 10, 2026
github-actions Bot added a commit that referenced this pull request Sep 10, 2026
@williamhe723
williamhe723 marked this pull request as draft September 10, 2026 17:22
github-actions Bot added a commit that referenced this pull request Sep 10, 2026
github-actions Bot added a commit that referenced this pull request Sep 10, 2026
@williamhe723
williamhe723 marked this pull request as ready for review September 10, 2026 17:49
@williamhe723

Copy link
Copy Markdown
Contributor Author

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.

@williamhe723

Copy link
Copy Markdown
Contributor Author

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

github-actions Bot added a commit that referenced this pull request Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant