Fix JS crash in EditablePanel component (#2222)

This commit is contained in:
Alexander Matyushentsev 2019-08-26 12:00:02 -07:00 committed by GitHub
parent 608361ce20
commit 44a69e8a73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -38,7 +38,7 @@ export class EditablePanel<T = {}> extends React.Component<EditablePanelProps<T>
}
public UNSAFE_componentWillReceiveProps(nextProps: EditablePanelProps<T>) {
if (JSON.stringify(this.props.values) !== JSON.stringify(nextProps.values)) {
if (this.formApi && JSON.stringify(this.props.values) !== JSON.stringify(nextProps.values)) {
this.formApi.setAllValues(nextProps.values);
}
}