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

fix(widgets): push widget default values to entry state #1662

Closed
wants to merge 2 commits into from

Conversation

erquhart
Copy link
Contributor

Summary

Fixes #1424 (and possibly others).

We currently use defaultProps to set default values in widgets, but these default values are local to the widget control component and don't make it to the Redux store unless the user changes the value of the field.

This PR drops widget control use of defaultProps and instead sets the default value in componentDidMount.

@verythorough
Copy link
Contributor

verythorough commented Aug 23, 2018

Deploy preview for netlify-cms-www ready!

Built with commit 045a91f

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

@verythorough
Copy link
Contributor

verythorough commented Aug 23, 2018

Deploy preview for cms-demo ready!

Built with commit 045a91f

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

@tech4him1
Copy link
Contributor

Likely to also fix #1449.

@erquhart
Copy link
Contributor Author

Tested this deeper and found that, because children mount before parents, componentDidMount can't be used to set default values for nested controls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

'boolean' widget without default value behaves strangely
3 participants