Skip to content

Commit 6a63ec9

Browse files
committed
chore(changeset): declare the row change a narrowing for readers of row.value
Claude-Session: https://claude.ai/code/session_01QGA6bzuch27y29tUbeb1y9 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 3abe273 commit 6a63ec9

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

‎.changeset/26306-filter-builder-spec-row-value.md‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22
'@object-ui/components': patch
33
---
44

5-
fix(components): the filter builder's row takes the spec rule's value, so the authored group a `filter-builder` node carries reaches the builder as it is
5+
fix(components)!: the filter builder's row takes the spec rule's value, so the authored group a `filter-builder` node carries reaches the builder as it is
66

7-
Clause-②: yes (widening)
7+
Clause-②: yes (narrowing)
88
Metadata-protocol: none
99

10+
<!-- adr-0087: not-required (runtime-interface-only ui/packages/components/src/custom/filter-builder.tsx#FilterBuilderRow) A published runtime TypeScript interface of a React component with no metadata surface: no Zod schema, no spec declaration and no stored representation, so `objectstack migrate meta` has nothing to rewrite; the affected party is a TypeScript consumer, reached by its own compiler. -->
11+
12+
**BREAKING** type-surface change, compile-time only. `FilterBuilderRow` is exported from `@object-ui/components`. What the builder accepts widens, and what a reader of `row.value` may assume narrows: the member is now optional and admits `null`. Nothing changes at runtime for a reader: the builder already passed both through.
13+
1014
`FilterBuilderRow.value` is now `ViewFilterRule['value']` from `@objectstack/spec/ui`, taken by reference, plus the builder's own list member `(string | number | boolean)[]`. Before, it was the builder's own `string | number | boolean | (string | number | boolean)[]`, and it was required. Measured against the spec's rule, that refused two shapes an authored row takes:
1115

1216
- **Value omitted.** The spec's value is optional, because a value-less operator (`is_null`, `is_empty`, …) carries none. The builder's was required, so the authored `FilterGroup` from `@object-ui/types` was not assignable to the builder's group. The member is optional now.
@@ -18,4 +22,4 @@ Both cases also fix a field switch. Switching the field of a row with no value u
1822

1923
The `filter-builder` renderer now hands the authored `value` and `fields` to the builder with no cast. It declares `value` on its props, because a host that binds the node forwards the group it holds.
2024

21-
Code that reads `row.value` from a `FilterBuilderRow` now sees `undefined` and `null` in its type. The builder already passed both through at runtime.
25+
**Migration.** Code that reads `row.value` from a `FilterBuilderRow` (a host's `onChange` handler, for instance) handles `undefined` and `null` before using the value, or narrows first with an unset check (`value === undefined || value === null || value === ''`). Code that only writes rows needs no change.

0 commit comments

Comments
 (0)