Repository navigation
fix(ui): a multi-value field's list filter offers contains / does not contain, not the operators the server refuses - #35991
Conversation
…er accepts The list's quick filter and the shared FilterBuilder keyed operators on the field type alone, so a multi-select offered equals / in, which the server refuses on a JSON column. Both now read one helper, jsonColumnFilterOperators, keyed on the type and multiple through the spec's own sets. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me
…al set; changeset Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me
…edo's hunks Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me
…order Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me
|
repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4 维护者速读
席位核对ACCEPT · head
R1: CI is still running. Flip ready and land once it is green. |
…ence in the filter builder The builder now relates the spec's multi-value predicate to the driver's JSON-column refusal, so it names the card that owns their divergence, as the plugin-detail pin requires of every such file. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me
|
repo:objectstack#5 · os-bill · session_01Utp6CZiaBg6rk7dpy1s9Me CI fix · head
|
…ltiselect row seeds contains The shared filter builder now seeds contains on a multi-value column (the server refuses equality on its JSON column), so the equality control no longer applies there; that seed is pinned on its own. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me
|
repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4 维护者速读
席位核对delta ACCEPT (on ACCEPT 7057604096) · head
R1 (carried): CI is running. Land when it is green. |
|
repo:objectstack#5 · os-bill · session_01Utp6CZiaBg6rk7dpy1s9Me CI fix 2 · head
|
|
repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4 维护者速读
席位核对delta ACCEPT (on delta 7057776804) · head
R1 (carried): CI is running. Land when it is green. |
|
repo:objectstack#5 · os-bill · session_01Utp6CZiaBg6rk7dpy1s9Me Landing · head
Nit (changeset names only the list; FilterConditionField gets the same multi-value set): declined here, since a push would rerun the whole CI for a changelog line. The area will carry it in the next changeset that touches the shared builder. Status: |
Requested by Bill · project thread
repo:objectstack#5 · os-bill · session_01Utp6CZiaBg6rk7dpy1s9Me
Fixes #35559
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
The list's two filter surfaces chose operators from the field TYPE alone, so a multi-value field offered operators the server refuses on a JSON column (
JSON_COLUMN_INCOMPATIBLE_OPERATORS,@objectstack/core): picking a value sent["f_multiselect","=","red"]and the list showed the refusal. Both surfaces now read one helper keyed on the same two field facts the server's faces read (type andmultiple, through the spec'sisMultiValueFieldandSTRUCTURED_JSON_TYPES):@object-ui/componentsfilter-builder.tsx: new exportedjsonColumnFilterOperators(field)andoperatorsForField(field). A multi-value field (multiselect/checkboxes/tags, orselect/radio/lookup/userwithmultiple: true) offerscontains,not_contains,is_empty,is_not_empty; a structured-JSON field offersis_empty/is_not_emptyonly; every other field keeps its type bucket. The row's own operator is always mounted, so a saved refused operator still shows and can be changed.containson a multi-value option field draws a single-option picker (the spec's$containstakes one comparand; an array comparand is refused, measured below). "Add filter" and a field switch land oncontainsinstead ofequalsfor such a field.FilterBuilderfield descriptors acceptmultiple;emptyCheckArmreads it too.operatorsForFieldType(what a row can HOLD, read by the dataset and flow inspectors) is unchanged.@object-ui/plugin-listquick filter (conditions/):quickFilterOperators(field)= the same helper, else the family list.FilterValuePaneland the default operator read it.ListView.tsx: the filter field descriptors carrymultiple: field.multiple === true(one line, claim amended by the seat), without whichselect/lookup/userwithmultiple: truecannot be told from single-value.Read first, by risk:
filter-builder.tsxofferedOperatorsForRow/jsonColumnFilterOperators(the offer and the held-operator rule).filter-builder.tsxisOptionDrivenValueControl(the value control forcontainson a multi-value option field).conditions/conditionModel.tsquickFilterOperators.Follow-up (nested under #35559)
=/$in) and the condition editors that build filter fields withoutmultiple(FilterConditionField, Studio / metadata-admin condition rows). Both were found by reading and are outside this PR's surface.Tests
Pins
components/src/__tests__/filter-builder-json-column-operators.test.tsx(new): the helper per type andmultiple; the dropdown onselectwithmultiple: true,multiselect,address, singleselect(control); a storedequalsstill loads beside the four;containsdraws a single-option Select; a field switch and "Add filter" land oncontains.plugin-list/src/conditions/__tests__/listConditions.test.tsx(new top-level describe): every operator either surface offers for six multi-value fields and one structured field is lowered through the list's ownconvertFilterGroupToASTand the spec'sparseFilterAST, and none of the resulting$-operators is in the server'sJSON_COLUMN_INCOMPATIBLE_OPERATORS(read frompackages/core/src/utils/json-column-operator-refusal.ts, with a lit control that$eq/$inare in it and$contains/$emptyare not); control leg: equals / not equals / in / not in each reach a refused operator; 「包含」 sends["responsibilities","contains","quality_lead"]→$contains; single select unchanged; one pick replaces another; a saved refused operator still draws; zh-CN and en labels for both surfaces.components/src/__tests__/filter-builder-empty-null-pair-11810.test.tsx: themultiselect/tagscase now pins the JSON-column offer (empty pair, no null pair to a fresh choice) and that a storedis_nullstill loads with the empty-list hint.Runs (head 0153d1f)
pnpm --dir ui exec vitest run --maxWorkers=2 packages/components/ packages/plugin-list/→ Test Files 681 passed, 1 skipped (682); Tests 6774 passed, 24 skipped; lock VERDICT command-exit 0.pnpm --filter @object-ui/components --filter @object-ui/plugin-list run type-check→ exit 0 (bothtsc --noEmit && tsc -p tsconfig.test.json).scripts/ablation-replace.mjs, test subject resolved through the vitest alias tosrc, so no build): deleting the multi-value line ofjsonColumnFilterOperators→ anchor 1 → 0, blob f440145ffece → 3a729237258e; the two pin files: 9 failed, 57 passed (exit 1). Restore: blob == HEAD,git diff HEADempty; rerun 66 passed (exit 0).Acceptance notes
showcase_field_zoo), and each server answer over REST:multiselect/checkboxes: before 是其中之一 / 不是其中之一 / 为空 / 不为空, one pick sent["f_multiselect","=","red"]→ 400INVALID_FILTER, list showed 「该视图的查询被拒绝」; after 包含 / 不包含 / 为空 / 不为空, one pick sends["f_multiselect","contains","red"]→ 200, 1 row.tags: before 包含 / 不包含 / 等于 / 开头是 / 为空 / 不为空 (等于, 开头是 refused); after the four.userwithmultiple: true: before 是其中之一 / 不是其中之一 / 为空 / 不为空; after the four.FilterBuilder),multiselect/checkboxes/tags: before 等于 / 不等于 / 包含 / 包含(忽略大小写) / 不包含 / 为空 / 不为空 / 以…开头 / 以…结尾 / 为 null / 不为 null;usermultiple: 等于 / 不等于 / 为空 / 不为空 / 属于 / 不属于; after the four on each.select: unchanged on both surfaces (是其中之一 … / 等于 / 不等于 / 为空 / 不为空 / 属于 / 不属于),["f_select","=","low"]→ 200.multiselect,checkboxes,tags:=,!=,in,nin,startswith→ 400INVALID_FILTER;contains,notcontains,isempty,isnotempty→ 200;containswith an array value → 400, socontainsnames one member; anorof twocontains→ 200 (any-of is two rows under OR in the advanced panel).FilterUI(writes values, no operator choice); the dashboard filter bar (writes values; its host lowers aselect/lookupfilter to bare equality or$inin@object-ui/coredashboard-filters.tsbuildFilterCondition, outside this claim; not measured against a multi-value target); thefilter-builderrenderer forwardsFilterBuilderSchema.fields, whose declared types (FILTER_FIELD_TYPES) and keys carry no multi-value type and nomultiple, so it has no consumer of this offer.FilterConditionFieldin@object-ui/fields, the metadata-admin widgets) pass nomultiple: they get the fix formultiselect/checkboxes/tagsby type, and keep the type bucket forselect/lookup/userwithmultiple: true. Outside this claim.contains: the server's membership test is array-only, socontainson an object value would always answer no rows.contains; a second pick replaces the first (listbox not multiselectable).Verification
Two minutes: in showcase, open 字段动物园, 筛选 → Multi-select. The operator reads 包含; tick Red; the list shows one record (Specimen — Full) and the chip reads 「Multi-select:包含 Red」.
Generated by Claude Code