Skip to content

[BUG] - can't have an empty array for Prisma fields #493

@ianwatts22

Description

@ianwatts22

Description

Prisma arrays technically cannot be optional, so when you don't enter values it creates an empty array. When trying to edit an entry in NextAdmin, it won't let me leave this array empty, as it requires a value. Need it to write an empty array by default. We're getting around it right now by disabling editing on this field.

image

Reproduction URL

cannot share

Reproduction steps

Any Prisma value with an empty array. Below is the structure we have.

model Collection {
  id          Int       @id @default(autoincrement())
  createdAt   DateTime  @default(now())
  type        CollectionType
  overrides   Override[]
}

enum Override {
  ROTATE
  AUTOCROP
  DUPLICATE
}

Next router

App router

Next Admin version

7.0.1

Screenshots

![DESCRIPTION](LINK.png)

Next Admin options

No response

Logs

No response

Browsers

Chrome, Safari

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions