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

Feature/#2017 improve pristine input handling #2280

Conversation

lmcorreia
Copy link
Contributor

@lmcorreia lmcorreia commented Apr 9, 2019

Summary
Closes #2017, closes #1990 and closes #1449 , continuing on the spirit of #1662.
In essence, this PR:

  • forces default values for the widgets to be set in the Redux store which in turn forces the data serializer to consider them when persisting entries
  • introduces a fallback to the widget's default value when a default is not provided for the field in the settings
  • introduces emptyValue as a new config options for fields such that a field left pristine will persist with this value (or not persist at all if this is set to null) [<- I'm probably gonna suggest something else for this]
  • ...

Test plan

  • Coming soon

A picture of a cute animal (not mandatory but encouraged)

  • Coming soon

@netlify
Copy link

netlify bot commented Apr 9, 2019

Preview proposed changes to the CMS demo site in the link below:

Built with commit 6a1cbc6

https://deploy-preview-2280--cms-demo.netlify.com

@erquhart
Copy link
Contributor

Thanks @lmcorreia!

I mentioned in #2017 that we should lean on widgets to handle their own default values, any thoughts on that?

@lmcorreia
Copy link
Contributor Author

@erquhart So far I'm going with the defaultProps if they're available for the controller (only if no default has been specified in settings) as that was the easiest way to start covering some ground. But I think you're hinting at what I've also considered: a new addition to the widgets API that would allow a standard way of specifying the default behaviour with regards to default values and/or the value to persist in the store when the inputs are pristine - maybe in kind of the same way the isValid() works for validation even in custom widgets?

I'm actually more interested to hear your thoughts and concerns on this one but in any case I've already planned to tackle this and we can discuss and refactor before the PR is posted for good. :)

@netlify
Copy link

netlify bot commented May 3, 2019

Preview proposed changes to netlifycms.org in the link below:

Built with commit 6a1cbc6

https://deploy-preview-2280--netlify-cms-www.netlify.com

@stale
Copy link

stale bot commented Oct 29, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Oct 29, 2019
@stale stale bot removed the wontfix label Oct 29, 2019
@erquhart
Copy link
Contributor

erquhart commented Nov 7, 2019

@lmcorreia closing for inactivity, but feel free to reopen if you're still working on this.

@erquhart erquhart closed this Nov 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants