Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ianwatts22 opened this issue Dec 2, 2024 · 1 comment
Open

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

ianwatts22 opened this issue Dec 2, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@ianwatts22
Copy link

ianwatts22 commented Dec 2, 2024

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

@ianwatts22 ianwatts22 added the bug Something isn't working label Dec 2, 2024
@foyarash
Copy link
Collaborator

foyarash commented Dec 6, 2024

Hello, would it not be possible for you to add @default([]) to your field ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants