Skip to content

Commit 954e053

Browse files
committed
Use validateProps in .update
1 parent 7fbcdaf commit 954e053

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,13 @@ export function getPropTypesMixin(userOpts) {
6666

6767
// Run validators for only the props passed in, not
6868
// all declared PropTypes.
69-
Object.keys(props).forEach((key) => {
69+
const propTypesToValidate = Object.keys(props).reduce((result, key) => {
7070
if (Object.prototype.hasOwnProperty.call(propTypes, key)) {
71-
const validator = propTypes[key];
72-
validateProp(validator, props, key, `${modelName}.update`);
71+
return { ...result, [key]: propTypes[key] };
7372
}
74-
});
73+
return result;
74+
}, {});
75+
validateProps(props, propTypesToValidate, `${modelName}.update`);
7576
}
7677

7778
return super.update(...args);

0 commit comments

Comments
 (0)