Better shouldComponentUpdate detection in withFragments

This commit is contained in:
Chi Vinh Le
2017-08-18 23:19:10 +07:00
parent 44ec469fa5
commit 5028f4adf4
+2 -2
View File
@@ -86,9 +86,9 @@ export default (fragments) => hoistStatics((BaseComponent) => {
}
shouldComponentUpdate(next) {
const onlyQueryDataChanges = this.shallowChanges.every((key) => this.fragmentKeys.indexOf(key) >= 0);
// If only query data was changed.
if (this.queryDataHasChanged && this.shallowChanges.every((key) => this.fragmentKeys.indexOf(key) >= 0)) {
if (onlyQueryDataChanges) {
return this.queryDataHasChanged;
}