Nullable enum values cannot be set to null when being edited in Prisma Studio
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
- Edit a nullable enum value by attempting to set the value to
NULL - Click out of the cell, or click "Save changes", or do anything else that would cause the cell to lose focus
- 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
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.
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
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
@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.
Still a thing.
- An enum field is cleared with Delete/Backspace
- Change is confirmed with Enter or moving focus out of this field
- 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.
Still a issue
Making the enum null only works by pressing delete or backspace when the field is selected.
Any plans to fix it?