We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
There is no reliable way to clear or reset an optional field.
In this example, the email field is optional. Creating a user without an email results in:
email
{ "id": 1, "name": "Max", "email": null }
After adding an email:
{ "id": 1, "name": "Max", "email": "max@test.com" }
However, attempting to "remove" the email results in:
{ "id": 1, "name": "Max", "email": "" }
Expected behavior:
null
"bio": { "root": { "type": "root", "format": "", "indent": 0, "version": 1, "children": [ { "type": "paragraph", "format": "", "indent": 0, "version": 1, "children": [], "direction": null, "textStyle": "", "textFormat": 0 } ], "direction": null } }
Ensure that clearing an optional field properly resets it to null, maintaining consistency across all field types.
https://github.com/payloadcms/payload/tree/main/templates/website
""
Not sure
Payload: Latest Next.js: Latest Node: 20+
The text was updated successfully, but these errors were encountered:
GermanJablo
No branches or pull requests
Describe the Bug
Issue: No Proper Way to Clear/Reset an Optional Field
There is no reliable way to clear or reset an optional field.
Example: User Collection
In this example, the
email
field is optional. Creating a user without an email results in:After adding an email:
However, attempting to "remove" the email results in:
Expected behavior:
Why This Is a Problem
null
value.null
, they transform into an unnecessary structured object:Suggested Fix
Ensure that clearing an optional field properly resets it to
null
, maintaining consistency across all field types.Link to the code that reproduces this issue
https://github.com/payloadcms/payload/tree/main/templates/website
Reproduction Steps
email
isnull
.null
or remove the field).email
is stored as an empty string (""
) instead ofnull
.Which area(s) are affected? (Select all that apply)
Not sure
Environment Info
The text was updated successfully, but these errors were encountered: