Skip to content

Commit 7f2405e

Browse files
committed
Revert "better update attributes for hero blocks"
This reverts commit 71c12fb.
1 parent 962b8d9 commit 7f2405e

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

dist/js/editor.blocks.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -15037,9 +15037,12 @@ var HeroEdit = function (_Component) {
1503715037
var defaults = this.getDefaults(attributes);
1503815038
var newAttributes = this.getNewAttributes(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends___default()({}, attributes, defaults));
1503915039

15040-
if (!__WEBPACK_IMPORTED_MODULE_6__wordpress_is_shallow_equal___default()(newAttributes, this.props.attributes)) {
15041-
setAttributes(newAttributes);
15042-
}
15040+
setAttributes(newAttributes);
15041+
}
15042+
}, {
15043+
key: 'shouldComponentUpdate',
15044+
value: function shouldComponentUpdate(nextProps) {
15045+
return !__WEBPACK_IMPORTED_MODULE_6__wordpress_is_shallow_equal___default()(nextProps.attributes, this.props.attributes);
1504315046
}
1504415047
}, {
1504515048
key: 'componentDidMount',

src/blocks/hero/edit.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,11 @@ class HeroEdit extends Component {
136136
const defaults = this.getDefaults( attributes );
137137
const newAttributes = this.getNewAttributes( { ...attributes, ...defaults } );
138138

139-
if ( ! isShallowEqual( newAttributes, this.props.attributes ) ) {
140-
setAttributes( newAttributes );
141-
}
139+
setAttributes( newAttributes );
140+
}
141+
142+
shouldComponentUpdate( nextProps ) {
143+
return ! isShallowEqual( nextProps.attributes, this.props.attributes );
142144
}
143145

144146
componentDidMount() {

0 commit comments

Comments
 (0)