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
{{ message }}
Repository navigation
Commit b93232c
Browse filesBrowse the repository at this point in the historyBrowse files
feat(react,types): read canonical visibleWhen in renderers (ADR-0089)
`@objectstack/spec` unifies conditional visibility under the canonical key
`visibleWhen`, folding the deprecated `visibleOn` (view form) / `visibility`
(page component) aliases into it at parse. Update ObjectUI to read the
canonical key:
- SchemaRenderer (page): evaluate `visibleWhen` first (show-when-truthy), keep
`visibleOn`/`visibility` as defensive reads for raw metadata; strip
`visibleWhen` from DOM props.
- spec-bridge: page bridge maps `visibleWhen ?? visibility` → node `visibleWhen`;
form-view bridge maps `visibleWhen ?? visibleOn` → the ObjectForm view-level
predicate slot.
- react FormRenderer: prefer `visibleWhen` over the `visibleOn` alias.
- types: component base (`BaseSchema` / `base.zod`) gains canonical `visibleWhen`;
`visibleOn` marked `@deprecated`.
Fully back-compat: existing `visibleOn`/`visibility` metadata keeps working via
the alias reads. Addresses objectstack-ai/objectstack#2904.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017fU25GeYSPKq9eEURsQffF
ADR-0089: read the canonical `visibleWhen` conditional-visibility predicate in the form + page renderers.
7
+
8
+
`@objectstack/spec` now unifies conditional visibility under a single canonical key, `visibleWhen`, and folds the deprecated `visibleOn` (view form) / `visibility` (page component) aliases into it at parse. This updates ObjectUI to read the canonical key:
9
+
10
+
-**Page renderer** (`SchemaRenderer`) — evaluates `visibleWhen` first (show-when-truthy), then the deprecated `visibleOn` / `visibility` as a defensive read for raw / un-normalized metadata. `visibleWhen` is stripped from DOM props.
11
+
-**Spec→node bridges** — the page bridge maps a component's `visibleWhen ?? visibility` onto the node's canonical `visibleWhen`; the form-view bridge maps a field's `visibleWhen ?? visibleOn` onto the ObjectForm view-level predicate slot.
12
+
-**Form renderers** — the `@object-ui/react``FormRenderer` prefers `visibleWhen` over the `visibleOn` alias. (`ObjectForm`/`form.tsx` already evaluated `visibleWhen`.)
13
+
-**Types** — the component base schema (`BaseSchema` / `base.zod`) gains the canonical `visibleWhen`; `visibleOn` is marked `@deprecated`.
14
+
15
+
Fully back-compat: existing `visibleOn` / `visibility` metadata keeps working through the alias reads.
0 commit comments