prisma / studio

🎙️ The easiest way to explore and manipulate your data in all of your Prisma projects.
https://www.prisma.io/studio
1.86k stars 47 forks source link

Nullable enum values cannot be set to null when being edited in Prisma Studio #647

Open Ezard opened 3 years ago

Ezard commented 3 years ago

Bug description

A nullable enum value cannot be set to null when being edited in Prisma Studio. Instead, only a non-null value can be selected. The cell will be populated with a non-null value after being edited and then losing focus

How to reproduce

  1. Edit a nullable enum value by attempting to set the value to NULL
  2. Click out of the cell, or click "Save changes", or do anything else that would cause the cell to lose focus
  3. The value of the cell will be set to a non-null value

Expected behavior

Nullable enum values should be able to be set to null via Prisma Studio

Prisma information

n/a

Environment & setup

prisma               : 2.18.0
@prisma/client       : Not found
Current platform     : windows
Query Engine         : query-engine da6fafb57b24e0b61ca20960c64e2d41f9e8cff1 (at ..\..\..\..\ProgramData\nvm\v14.16.0\node_modules\prisma\node_modules\@prisma\engines\query-engine-windows.exe)
Migration Engine     : migration-engine-cli da6fafb57b24e0b61ca20960c64e2d41f9e8cff1 (at ..\..\..\..\ProgramData\nvm\v14.16.0\node_modules\prisma\node_modules\@prisma\engines\migration-engine-windows.exe)
Introspection Engine : introspection-core da6fafb57b24e0b61ca20960c64e2d41f9e8cff1 (at ..\..\..\..\ProgramData\nvm\v14.16.0\node_modules\prisma\node_modules\@prisma\engines\introspection-engine-windows.exe)
Format Binary        : prisma-fmt da6fafb57b24e0b61ca20960c64e2d41f9e8cff1 (at ..\..\..\..\ProgramData\nvm\v14.16.0\node_modules\prisma\node_modules\@prisma\engines\prisma-fmt-windows.exe)
Studio               : 0.356.0
sdnts commented 3 years ago

Thanks for reporting this @Ezard! You're correct that null isn't a possible option in the enum dropdown menu. I'll fix that.

In the mean time, you can also select the cell, and press Del or Backspace to set the value to null. It should not revert back then.

Ezard commented 3 years ago

Ahh, thanks @madebysid

On a related note, it seems like pressing Backspace when the cell is selected works, but pressing Delete doesn't When Delete is pressed, the cell just becomes editable

itsazzad commented 3 years ago

In the mean time, you can also select the cell, and press Del or Backspace to set the value to null. It should not revert back then.

Not working @madebysid

ajRiverav commented 3 years ago

@Ezard what I have worked around this by setting the cell empty (i.e. deleting its content) and then SAVE CHANGES. That sets it to null. See if that works.

devklepacki commented 1 year ago

Still a thing.

  1. An enum field is cleared with Delete/Backspace
  2. Change is confirmed with Enter or moving focus out of this field
  3. The field is again automatically set to the first enum value

Clearing value and clicking Save Changes right away does not work, because the value is automatically set again right when the focus is moved off the field.

MatinAniss commented 1 year ago

Still a issue

Making the enum null only works by pressing delete or backspace when the field is selected.

bolshchikov commented 10 months ago

Any plans to fix it?