Skip to content

Commit bf37375

Browse files
emilisbethanshar
authored andcommitted
Do not compare unnecessary prop values in modifiers (#543)
1 parent 0142d09 commit bf37375

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/commons/baseComponent.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ export default function baseComponent(usePure) {
8383
}
8484

8585
updateModifiers(currentProps, nextProps) {
86-
const allKeys = _.union([..._.keys(currentProps), ..._.keys(nextProps)]);
86+
const ignoredKeys = ['children', 'forwardedRef', 'style', 'testID'];
87+
const allKeys = _.union([..._.keys(currentProps), ..._.keys(nextProps)]).filter((key) => !ignoredKeys.includes(key));
8788
const changedKeys = _.filter(allKeys, key => !_.isEqual(currentProps[key], nextProps[key]));
8889

8990
const options = {};

src/commons/modifiers.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,8 @@ props = this.props,) {
254254
}
255255

256256
export function getAlteredModifiersOptions(currentProps, nextProps) {
257-
const allKeys = _.union([..._.keys(currentProps), ..._.keys(nextProps)]);
257+
const ignoredKeys = ['children', 'forwardedRef', 'style', 'testID'];
258+
const allKeys = _.union([..._.keys(currentProps), ..._.keys(nextProps)]).filter((key) => !ignoredKeys.includes(key));
258259
const changedKeys = _.filter(allKeys, key => !_.isEqual(currentProps[key], nextProps[key]));
259260

260261
const options = {};

0 commit comments

Comments
 (0)