Skip to content
This repository was archived by the owner on Aug 23, 2022. It is now read-only.

Commit b1b0d12

Browse files
committed
Merge branch 'shallow-compare' of https://github.com/tw0517tw/react-redux-form into tw0517tw-shallow-compare
2 parents b5ebfbc + ad462e8 commit b1b0d12

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@
7272
"dependencies": {
7373
"flat": "^2.0.0",
7474
"icepick": "^1.1.0",
75-
"lodash": "^4.10.0"
75+
"lodash": "^4.10.0",
76+
"react-addons-shallow-compare": "^15.0.2"
7677
},
7778
"peerDependencies": {
7879
"react": "^0.14.0 || ^15.0.0",

src/components/field-component.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { Component, PropTypes } from 'react';
2+
import shallowCompare from 'react-addons-shallow-compare';
23
import connect from 'react-redux/lib/components/connect';
34

45
import _get from 'lodash/get';
@@ -161,6 +162,10 @@ function createFieldClass(customControlPropsMap = {}, defaultProps = {}) {
161162
};
162163

163164
class Field extends Component {
165+
shouldComponentUpdate(nextProps, nextState) {
166+
return shallowCompare(this, nextProps, nextState);
167+
}
168+
164169
render() {
165170
const { props } = this;
166171
const component = getFieldWrapper(props);

0 commit comments

Comments
 (0)