fix: allow clearing unique optional attributes in bulk edit#9963
fix: allow clearing unique optional attributes in bulk edit#9963lancamat1 wants to merge 6 commits into
Conversation
A unique + optional attribute is dropped entirely from the bulk-edit form, so its "Set empty" (set-to-null) action is never available. This test asserts the attribute is retained in bulk update while unique + required stays removed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The bulk-edit form dropped every unique attribute, so a unique + optional attribute could not be edited at all -- even though clearing it to null on all selected rows is safe (uniqueness never collides on null). Keep unique + optional attributes in bulk update and render them clear-only: label plus the existing "Set empty" reset action, with no value input (a shared value would violate uniqueness). Unique + required attributes stay excluded. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
All reported issues were addressed across 5 files
Confidence score: 5/5
- Safe to merge after the addressed issues were fixed.
Shadow auto-approve: would not auto-approve because issues were found.
Re-trigger cubic
Adding the unique-bulk dispatch guard shifted two pre-existing tracked TS errors in dynamic-form.tsx (no new/removed errors); regenerate the results entry (content hash + line numbers) so betterer CI passes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Shadow auto-approve: would not auto-approve. Auto-approval blocked by 1 unresolved issue from previous reviews.
Re-trigger cubic
The bulk-edit test additions changed getFormFieldsFromSchema.test.ts content without refreshing its betterer results key hash, so betterer ci failed with "212 issues stayed the same, but your code has changed in other ways". The tracked TS-issue set is unchanged; only the file content hash needed updating. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Shadow auto-approve: would not auto-approve. Auto-approval blocked by 1 unresolved issue from previous reviews.
Re-trigger cubic
…bulk edit Gate the clear-only dispatch on !props.disabled so a disabled unique attribute is not routed to BulkUpdateUniqueField, whose ResetAction would otherwise let it be cleared despite being disabled -- matching how every other field suppresses its reset action when disabled. Addresses cubic review. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
0 issues found across 2 files (changes from recent commits).
Shadow auto-approve: would auto-approve. Fixes a clear bug where unique+optional attributes were hidden in bulk edit, with the diff showing a focused filter change and clear-only UI using existing components. Tests lock the corrected behavior, and the change is bounded — no schema, API, or mutation changes.
Re-trigger cubic
Why
In the bulk-edit UI, an attribute that is both unique and optional did not
appear at all. The form dropped every unique attribute, so there was no way to act
on a unique+optional one — even though clearing it to null across the selected rows
is a perfectly safe operation (uniqueness never collides on null).
Goal: let users clear (set-to-empty) a unique+optional attribute in bulk, without
offering a shared value that would violate the uniqueness constraint.
Non-goals: unique+required attributes remain excluded from bulk edit (no safe
bulk action exists for them). No change to how the value is written — only which
fields the bulk form exposes and how a unique one is presented.
What changed
Behavioral changes:
a label plus the existing "Set empty" checkbox, and no value input.
Implementation notes:
getFormFieldsFromSchemafilter relaxed from!uniqueto!unique || optionalin bulk update.
DynamicFieldroutesisBulkUpdate && uniquefields to a new smallbulk-update-unique.field.tsxthat renders label + the existingResetActiononly. The
disabledprop was deliberately not reused — it also hides thereset action.
getUpdateMutationFromFormData) is unchanged;it already produced
{ value: null }for the "user/null" state.What stayed the same: no schema changes, no GraphQL/API contract changes, mutation
building untouched.
How to review
getFormFieldsFromSchema.ts— the one-line filter change.bulk-update-unique.field.tsx— new clear-only presentation (reusesResetAction/
LabelFormField).dynamic-form.tsx— dispatch guard.removes unique fields…was updated tooptional: false(it previously asserted the buggy removal of a unique+optional field); the new
test
keeps unique optional attributes…locks in the fix.How to test
Manual: bulk-select objects of a kind that has a unique+optional attribute → open
bulk edit → the attribute appears with a "Set empty" checkbox and no value input →
submitting with it ticked clears the value on all selected rows.
Impact & rollout
Checklist
Summary by cubic
Enable clearing unique + optional attributes in bulk edit by showing them as clear-only with a “Set empty” checkbox. Unique + required attributes remain hidden, and disabled unique fields keep their normal, non-clearable presentation.
Bug Fixes
Refactors
dynamic-form.tsxline shifts and refreshed hash forgetFormFieldsFromSchema.test.tsafter test additions; no new or removed TS errors.Written for commit b7594ac. Summary will update on new commits.