Skip to content

Commit

Permalink
fix(ui): hide array field "add" button if admin.readOnly: true is s…
Browse files Browse the repository at this point in the history
…et (#11184)

Fixes #11178
  • Loading branch information
r1tsuu authored Feb 14, 2025
1 parent 84c838c commit b1734b0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 1 addition & 2 deletions packages/ui/src/fields/Array/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,10 @@ export const ArrayFieldComponent: ArrayFieldClientComponent = (props) => {
)}
</DraggableSortable>
)}
{!hasMaxRows && (
{!hasMaxRows && !readOnly && (
<Button
buttonStyle="icon-label"
className={`${baseClass}__add-row`}
disabled={readOnly}
icon="plus"
iconPosition="left"
iconStyle="with-border"
Expand Down
1 change: 1 addition & 0 deletions test/fields/collections/Array/e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ describe('Array', () => {
await page.goto(url.create)
const field = page.locator('#field-readOnly__0__text')
await expect(field).toBeDisabled()
await expect(page.locator('#field-readOnly .array-field__add-row')).toBeHidden()
})

test('should have defaultValue', async () => {
Expand Down

0 comments on commit b1734b0

Please # to comment.