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

Delete the value of an optional text/image widget results in an empty string value #7120

Open
hangvane opened this issue Feb 26, 2024 · 0 comments · May be fixed by #7310
Open

Delete the value of an optional text/image widget results in an empty string value #7120

hangvane opened this issue Feb 26, 2024 · 0 comments · May be fixed by #7310
Labels
type: bug code to address defects in shipped code

Comments

@hangvane
Copy link

Describe the bug

If a text/image widget is required: false, removing the existing value of the widget would left an empty string value, rather than undefined or null.

To Reproduce

  1. Define an optional text/image widget
    fields: # The fields for each document, usually in front matter
      - {label: 'Excerpt', name: 'excerpt', widget: 'text', required: false}
      - {label: 'Image', name: 'photos', widget: 'image', required: false}
  1. Create a post with the widgets edited
  2. Edit the post again to delete the value of the widgets
  3. The field of two widgets left in the generated markdown file with empty strings:
excerpt: ""
photos: ""

Expected behavior

Remove the fields completely if the widget is optional and empty.

Screenshots

Applicable Versions:

  • Decap CMS version: 3.1.1

CMS configuration

Additional context

This bug is issued in #995, #2007, #2848, #1449, #2017. As replied #995 (comment), seems this bug should be fixed since 3.0.0.

@hangvane hangvane added the type: bug code to address defects in shipped code label Feb 26, 2024
hip3r added a commit to poslovnimediji/decap-cms that referenced this issue Oct 22, 2024
@hip3r hip3r linked a pull request Oct 22, 2024 that will close this issue
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant