allow nested widget previews to update
This commit is contained in:
parent
84ed450ac6
commit
09e631ded7
@ -2,7 +2,11 @@ import React from 'react';
|
||||
|
||||
class PreviewHOC extends React.Component {
|
||||
shouldComponentUpdate(nextProps) {
|
||||
return nextProps.value !== this.props.value;
|
||||
// Only re-render on value change, but always re-render objects and lists.
|
||||
// Their child widgets will each also be wrapped with this component, and
|
||||
// will only be updated on value change.
|
||||
const isWidgetContainer = ['object', 'list'].includes(nextProps.field.get('widget'));
|
||||
return isWidgetContainer || this.props.value !== nextProps.value;
|
||||
}
|
||||
|
||||
render() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user