fix(dashboard): allow adding metadata when all rows are non-primitive - #16290
fix(dashboard): allow adding metadata when all rows are non-primitive#16290Kavin-Bakyaraj wants to merge 1 commit into
Conversation
…primitive Row insertion was only reachable through each row's dropdown menu, and that menu is hidden for rows holding non-primitive values. When every metadata entry was an object or an array, every row was disabled and there was no way to add a new entry. Add a standalone 'Add row' action below the table, so metadata stays addable regardless of the state of the existing rows. Non-primitive rows stay read-only.
🦋 Changeset detectedLatest commit: 2adf08f The changes in this PR will be included in the next version bump. This PR includes changesets to release 79 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Thanks for the contribution! Initial automated review looks good. Adds a standalone "Add row" button to the metadata form so authors can insert new primitive rows when every existing row holds a non-primitive value and the per-row dropdown is hidden. Template complete, linked to verified issue #16287, changeset present with correct patch bump, four targeted tests pass. No security, performance, or correctness issues found. Heads up: PR #16288 also references issue #16287 and was opened earlier; if #16288 is merged first, this PR may be closed as a duplicate. Triggered by: new PR opened |
What
Adds a standalone "Add row" action to the metadata form, so metadata can still be added when every existing row holds a non-primitive value.
Closes #16287
Why
Row insertion is only reachable through each row's dropdown menu, and that menu is hidden for rows holding non-primitive values (
hidden: isDisabledonDropdownMenu.Trigger).When every metadata entry is an object or an array, every row is disabled, so no dropdown renders anywhere and no insertion point is left. For a product category whose only metadata is:
{ "category_image": { "id": "file_123", "url": "https://example.com/category.jpg" } }the editor is effectively read-only, and the author cannot add a primitive key without going through the API.
How
addRowappends a blank editable row throughuseFieldArray'sappend, independent of any row's disabled state.manage-variant-inventory-items-form.parseValuesstill passes their original values through unchanged.Two notes on the choices here:
metadata.edit.actions.addRowwas added toen.jsonand to$schema.json, including itsrequiredlist, which the existingvalidate-translationsspec enforces.Testing
Added
metadata-form.spec.tsxcovering:All four fail on
developand pass with this change (verified by reverting onlymetadata-form.tsx).ESLint and Prettier are clean on the touched files.