studio icon indicating copy to clipboard operation
studio copied to clipboard

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

Open Ezard opened this issue 4 years ago • 7 comments

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

  • OS: Windows 10
  • Database: PostgreSQL
  • Node.js version: 14.16.0
  • Prisma version:
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

Ezard avatar Mar 20 '21 21:03 Ezard

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.

sdnts avatar Mar 22 '21 12:03 sdnts

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

Ezard avatar Mar 22 '21 13:03 Ezard

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

itsazzad avatar May 05 '21 11:05 itsazzad

@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.

ajRiverav avatar May 27 '21 10:05 ajRiverav

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.

devklepacki avatar Dec 23 '22 11:12 devklepacki

Still a issue

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

MatinAniss avatar Feb 11 '23 05:02 MatinAniss

Any plans to fix it?

bolshchikov avatar Oct 27 '23 07:10 bolshchikov