Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
shouldComponentUpdate(nextProps, nextState) {
if (this.first) return true
const { injectedProps } = this.state // eslint-disable-line react/prop-types
return !(
shallowEqual(this.props, nextProps)
&& shallowEqual(
withoutFunctions(nextState.injectedProps),
withoutFunctions(injectedProps),
)
)
}
WithStateHandlers.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState) {
var propsChanged = nextProps !== this.props;
// the idea is to skip render if stateUpdater handler return undefined
// this allows to create no state update handlers with access to state and props
var stateChanged = !shallowEqual(nextState, this.state);
return propsChanged || stateChanged;
};
shouldComponentUpdate(nextProps, nextState) {
return (
!shallowEqual(omit(this.props, ['children']), omit(nextProps, ['children'])) ||
!shallowEqual(this.state, nextState) ||
!isEqual(this.childrenKey(this.props.children), this.childrenKey(nextProps.children))
)
}
return (nextProps, nextState, nextContext) => {
const {isPure} = nextProps;
return isPure ? !shallowEqual(instance.props, nextProps) || !shallowEqual(instance.context, nextContext) : true;
};
};
shouldClassNameUpdate: (props, nextProps, context, nextContext) => (
!shallowEqual(context.theme, nextContext.theme)
|| !shallowEqual(props.span, nextProps.span)
|| !shallowEqual(props.equalWidth, nextProps.equalWidth)
|| !shallowEqual(props.auto, nextProps.auto)
|| !shallowEqual(props.offset, nextProps.offset)
|| !shallowEqual(props.alignSelf, nextProps.alignSelf)
|| !shallowEqual(props.textAlign, nextProps.textAlign)
)
}
shouldComponentUpdate(props: ClazzProps, state: State) {
if (freezeTransition) {
if (state.pending) return false;
} else {
if (state.pending !== this.state.pending) {
return true;
}
}
return (
!shallowEqual(
extractInputProps(this.props),
extractInputProps(props)
) || !shallowEqual(sCUStateSubset(this.state), sCUStateSubset(state))
);
}
shouldClassNameUpdate: (props, nextProps, context, nextContext) => (
!shallowEqual(context.theme, nextContext.theme)
|| !shallowEqual(props.span, nextProps.span)
|| !shallowEqual(props.equalWidth, nextProps.equalWidth)
|| !shallowEqual(props.auto, nextProps.auto)
|| !shallowEqual(props.offset, nextProps.offset)
|| !shallowEqual(props.alignSelf, nextProps.alignSelf)
|| !shallowEqual(props.textAlign, nextProps.textAlign)
)
}
const tradingTimesAreEqual = (prevProps, nextProps) =>
shallowEqual(nextProps.tradingTimes, prevProps.tradingTimes);
componentDidUpdate (prevProps) {
if (!shallowEqual(this.filterLocationQuery(this.props.locationQuery), this.filterLocationQuery(prevProps.locationQuery))) {
this.props.searchActions.search()
}
}
export const shouldComponentUpdate = ({context, props}, [nextProps, , nextContext]) =>
nextProps.isPure ? !shallowEqual(props, nextProps) || !shallowEqual(context, nextContext) : true;