This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
Commit 9e7e1a5
refactor(react,components): one visibleWhen scope builder for SchemaRenderer and page:tabs (objectui#12992) (#13001)
Fixes #12992
Clause-②: yes
## What changed
- `@object-ui/react`: the module-private `configEvaluationScope` in
`SchemaRenderer.tsx` is now the exported
`buildNodeEvaluationScope(predicateScope, boundRecord, pageVariables)`,
with a JSDoc that names its four roots. It stays in
`SchemaRenderer.tsx`; the package entry already re-exports that module
(`export * from './SchemaRenderer.js'`), so `index.ts` needed no line.
The body of the function is unchanged; only the name, the `export`, and
the JSDoc moved. `SchemaRenderer`'s memo and `evaluateConfigBagInScope`
call it as before.
- `@object-ui/components` (`containers.tsx`, `PageTabsRenderer`):
- the derived-badge gate evaluator (objectui#12987) now calls
`buildNodeEvaluationScope(predicateScope, recordData, pageVariables)`
instead of spelling the scope inline;
- the item-level `visibleWhen` evaluator (`isItemVisible`) now composes
the builder too: the row spread flat underneath, the builder's scope,
then `record` / `data` set to the row on top. Each key gets the same
value as before (see "Root measurement"). After this, `containers.tsx`
spells `current_user` nowhere outside comments.
- Changeset: `@object-ui/react: minor` (new export),
`@object-ui/components: patch`.
### Name
`buildNodeEvaluationScope`, not `buildVisibleWhenScope`. The same scope
evaluates every expression `SchemaRenderer` evaluates on a node
(`properties`, `content`, the `visibleWhen` chain), and
`evaluateConfigBagInScope` uses it for action-container members. A
`visibleWhen`-only name would understate what a root added there
reaches.
## Root measurement (both spellings, at base `4dfdebdf5f`)
| root | `SchemaRenderer` (`configEvaluationScope`) | `page:tabs` badge
gates (inline) |
|---|---|---|
| ambient spread | `...predicateScope` | `...predicateScope` |
| `current_user` | `predicateScope?.user` | `(predicateScope as
any)?.user` |
| `record` | only for a non-array object row | only for a non-array
object row (same test) |
| `page` | `pageVariables` | `pageVariables` |
The two match on every root, so nothing changed and nothing needed a
fork. Their inputs come from the same hooks (`usePredicateScope`,
`useRecordContext().data`, `usePageVariables`). One input difference
already existed and is unchanged here: `SchemaRenderer` adds a node's
API-bound `data` to `predicateScope` once the binding answers, and the
badge passes the ambient scope (see Acceptance notes).
For the item-level scope, the old literal was `{ ...row,
...predicateScope, current_user, record: row, data: row, page }`. The
new one is `{ ...row, ...buildNodeEvaluationScope(...), record: row,
data: row }`. Every key ends with the same value: `current_user` and
`page` are written after the ambient spread in both, and `record` /
`data` are set to the row last in both, so an ambient `record` / `data`
is still covered, and an absent row still gives `record: undefined`, as
before.
## Note on the card's line address
The triage comment's `containers.tsx` line range points at the
item-level `isItemVisible` scope. The card body describes the badge
mirror from objectui#12987. The badge mirror is the one with the same
roots as `SchemaRenderer`. The item-level scope has extra roots (flat
row, `data`, unconditional `record`); those are kept unchanged and still
written out at that site.
## Tests
All run from the repo root through the shared verify lock. Each lock
line read `VERDICT command-exit 0` unless stated otherwise.
- New pin
`packages/react/src/__tests__/buildNodeEvaluationScope-12992.test.ts`:
the builder is exported from the package entry and returns the four
roots for a fixture. `record` is absent for `undefined` / `null` /
string / number / array. An ambient `record` is kept when no row is
bound, and a bound row overrides it. `current_user` and `page` are
written over the ambient spread.
- New source pin
`packages/components/src/__tests__/page-tabs-scope-builder-12992.test.ts`
(reads `containers.tsx` through `scripts/js-comment-mask.mjs`): the file
imports `buildNodeEvaluationScope` from `@object-ui/react`, calls it,
and spells no `current_user`.
- New pins plus the objectui#12987 pins
(`page-tabs-count-visible-when-12987.test.tsx`, unchanged): 3 files, 15
tests passed.
- Every test file under `packages/react` and `packages/components` that
names `visibleWhen`, `page:tabs`, `configEvaluationScope`,
`evaluateConfigBagInScope` or `useConfigBagEvaluator` (56 files, new
pins included): 56 files, 643 tests passed, at `654022a9c3`. Later
commits change only a test-file comment line and add the changeset.
- `packages/react/src/utils/configBag.pin.test.ts` (its allowlist names
the `boundRecord` row test in `SchemaRenderer.tsx`, which stays in that
file) plus the source pin: 2 files, 5 tests passed, at `0706ba39cd`.
- Type-check: closure build `pnpm --filter '@object-ui/components^...'
build` (8 projects, exit 0), then `pnpm --filter @object-ui/react
type-check && pnpm --filter @object-ui/components type-check`, exit 0.
With `--listFiles`, each package's `tsconfig.test.json` program includes
its new test file (1 hit each).
- Ablation, one run. `ablation-replace` put the inline badge mirror back
into `containers.tsx` (anchor 1 to 0, blob `7743264bea58` to
`d2e3e857a674`). The source pin went red (`no longer spells current_user
itself`; 1 failed, 9 passed across the source pin and the objectui#12987
pins), and the objectui#12987 pins stayed green. Restore: blob after
restore `7743264bea58`, equal to the HEAD blob, and `git diff HEAD` was
empty.
## Gates (exit codes, at `0706ba39cd`)
- `check:phantom-deps`, `check:self-import`,
`check:unreferenced-sources`, `check:doc-example-readers`,
`check:handler-key-reads`, `check:side-effects-array`,
`check:element-data-source-declaration`, `check:spec-symbols`,
`check:action-forward-parity`, `check:designer-field-key-parity`,
`check:icon-record-names`, `check:i18n-keys`, `check:i18n-drift`,
`check:i18n-designer-parity`, `check:control-bytes`,
`check:new-line-citations`, `node
scripts/check-hand-rolled-comment-mask.mjs`, `node
scripts/check-changeset-fixed.mjs`, `node
scripts/check-changeset-presence.mjs`: exit 0.
- `check:spec-floors`: exit 1. It is red on main too, and this change
does not affect it.
- Lint, narrowed to the 4 changed `.ts`/`.tsx` files (`eslint
--no-inline-config --format json`): 4 files, 0 errors. The warnings are
existing `no-explicit-any` hits in `containers.tsx`; this change removes
two `as any`. The root config enables no type-aware linting, so linting
only these files cannot change the result for any file this change does
not touch.
- NOT MEASURED, left to CI: full `packages/react/` and
`packages/components/` directory runs (the dispatch order forbids
whole-directory runs on the shared box). Also `check:readme-exports`: it
exits 1 because 29 packages are unbuilt in this worktree ("the
population COLLAPSED"), so it did not reach a verdict. It was not in the
dispatched battery.
## Acceptance notes
- Docs: `packages/react/README.md` does not list the new export. The
README was outside this card's file surface. Who picks this up: no one
yet.
- Unchanged input difference: the badge gates use the ambient predicate
scope without a gated node's own API-bound `data`, while
`SchemaRenderer` adds that `data` once the binding answers. This is a
guess from reading the code; no public entry point was measured. It
exists only if a gated node on a related list's path also has an API
`dataSource` binding and its `visibleWhen` reads `data.*`. Who picks
this up: no one yet.
Session: `https://claude.ai/code/session_01XVp19E1MYUTFM3dnkwz8gB`
---
_Generated by [Claude
Code](https://claude.ai/code/session_01XVp19E1MYUTFM3dnkwz8gB)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 1d3da6c commit 9e7e1a5
5 files changed
Lines changed: 172 additions & 40 deletions
File tree
- .changeset
- packages
- components/src
- __tests__
- renderers/layout
- react/src
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
662 | 662 | | |
663 | 663 | | |
664 | 664 | | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
665 | 670 | | |
666 | 671 | | |
667 | | - | |
668 | | - | |
| 672 | + | |
669 | 673 | | |
670 | 674 | | |
671 | | - | |
672 | 675 | | |
673 | 676 | | |
674 | 677 | | |
| |||
724 | 727 | | |
725 | 728 | | |
726 | 729 | | |
727 | | - | |
728 | | - | |
729 | | - | |
730 | | - | |
731 | | - | |
732 | | - | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
733 | 735 | | |
734 | 736 | | |
735 | 737 | | |
| |||
752 | 754 | | |
753 | 755 | | |
754 | 756 | | |
755 | | - | |
756 | | - | |
757 | | - | |
758 | | - | |
759 | | - | |
760 | | - | |
761 | | - | |
762 | | - | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
763 | 760 | | |
764 | 761 | | |
765 | 762 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
656 | 656 | | |
657 | 657 | | |
658 | 658 | | |
659 | | - | |
660 | | - | |
661 | | - | |
662 | | - | |
663 | | - | |
664 | | - | |
665 | | - | |
666 | | - | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
667 | 682 | | |
668 | | - | |
| 683 | + | |
669 | 684 | | |
670 | 685 | | |
671 | 686 | | |
672 | | - | |
673 | | - | |
674 | | - | |
675 | | - | |
676 | | - | |
677 | | - | |
678 | | - | |
679 | | - | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
680 | 697 | | |
681 | 698 | | |
682 | 699 | | |
| |||
740 | 757 | | |
741 | 758 | | |
742 | 759 | | |
743 | | - | |
| 760 | + | |
744 | 761 | | |
745 | 762 | | |
746 | 763 | | |
| |||
1268 | 1285 | | |
1269 | 1286 | | |
1270 | 1287 | | |
1271 | | - | |
1272 | | - | |
1273 | | - | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
1274 | 1293 | | |
1275 | | - | |
| 1294 | + | |
1276 | 1295 | | |
1277 | 1296 | | |
1278 | 1297 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
0 commit comments