Skip to content

Commit

Permalink
Check if props actually contain configuration fields before copying t…
Browse files Browse the repository at this point in the history
…hem (#2298)

This helps against the dropdown breaking because of an unhandled
exception due to a deselected input type and the following nonpresence
of configuration fields in the on change handler.

Fixes #2297
(cherry picked from commit e316629)
  • Loading branch information
dennisoelkers authored and Edmundo Alvarez committed May 30, 2016
1 parent a93031a commit b24d09d
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ const ConfigurationForm = React.createClass({
const effectiveTitleValue = (this.state && this.state.titleValue !== undefined ? this.state.titleValue : props.titleValue);
const defaultValues = {};

Object.keys(props.configFields).forEach(field => {
defaultValues[field] = props.configFields[field].default_value;
});
if (props.configFields) {
Object.keys(props.configFields).forEach(field => {
defaultValues[field] = props.configFields[field].default_value;
});
}

return {
configFields: $.extend({}, props.configFields),
Expand Down

0 comments on commit b24d09d

Please sign in to comment.