-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Allow optional fields to default to an empty string #1988
Comments
The big decision is to determine if we make this behavior the same for required: true | false |
Likely related to #1449 If you edit the field with a default value of |
@papandreou related, but there is enough difference that I believe we should keep them separate. |
I'd prefer to make this functionality available only if a field has |
@claygiffin May I ask what version of the cms you are on. I believe this issue was fixed in #1859, I tested locally with your sample widget in the config file, created a new post without touching the widget, but I can see |
@barthc ran it against 2.3.2, but I swore it did not work the other day. Worked! I was testing so many things. It was my first suggestion and I wonder if I just took his word that it was not working without testing my own case. 😜 |
@claygiffin can you test the case again? Also, Remember that all the existing posts need to have it existing as the default. This will not add it to an existing document if it is missing. |
@talves I am running on 2.3.2, and it isn't working for me still. However, I am also using it within the list module, which could possibly be part of the problem. It looks like it actually is working for me for fields outside the list module. |
Ah, then it might actually be #467 |
@claygiffin For me, it still works for fields inside list widget. Could you paste the content of your config file? |
That's weird. Double quotes should work just as well right? |
Is your feature request related to a problem? Please describe.
Currently, when a new post is created with optional fields, and those fields are left blank, the outputted .md file will omit those fields instead of returning an empty/null value. This can cause a problem when using GraphQL, which will fail to build when an undefined value is returned. However, it would function just fine with an empty string instead.
Describe the solution you'd like
We should allow empty strings as default values in the config file, and have those empty strings output in the markdown file.
Example:
would output in blog-post.md as:
Additional context
This actually seems to be what happens already, but only after a user has filled in the field, saved, and then edited it to be empty again. I would just like to expand this behavior to occur when the post is first created.
The text was updated successfully, but these errors were encountered: