Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Otherwise, for convenience short-circuit if all non-Relay props
// are scalar and equal
const keys = Object.keys(nextProps);
for (let ii = 0; ii < keys.length; ii++) {
const key = keys[ii];
if (key === '__relayContext') {
if (
nextState.prevPropsContext.environment !==
this.state.prevPropsContext.environment
) {
return true;
}
} else {
if (
!fragments.hasOwnProperty(key) &&
!isScalarAndEqual(nextProps[key], this.props[key])
) {
return true;
}
}
}
return false;
}
// Otherwise, for convenience short-circuit if all non-Relay props
// are scalar and equal
const keys = Object.keys(nextProps);
for (let ii = 0; ii < keys.length; ii++) {
const key = keys[ii];
if (key === '__relayContext') {
if (
nextState.prevContext.environment !==
this.state.prevContext.environment
) {
return true;
}
} else {
if (
!fragments.hasOwnProperty(key) &&
!isScalarAndEqual(nextProps[key], this.props[key])
) {
return true;
}
}
}
return false;
}
// Otherwise, for convenience short-circuit if all non-Relay props
// are scalar and equal
const keys = Object.keys(nextProps);
for (let ii = 0; ii < keys.length; ii++) {
const key = keys[ii];
if (key === '__relayContext') {
if (
nextState.prevContext.environment !==
this.state.prevContext.environment
) {
return true;
}
} else {
if (
!fragments.hasOwnProperty(key) &&
!isScalarAndEqual(nextProps[key], this.props[key])
) {
return true;
}
}
}
return false;
}
return true;
} // Otherwise, for convenience short-circuit if all non-Relay props
// are scalar and equal
var keys = Object.keys(nextProps);
for (var ii = 0; ii < keys.length; ii++) {
var key = keys[ii];
if (key === '__relayContext') {
if (this.state.prevPropsContext.environment !== nextState.prevPropsContext.environment || this.state.prevPropsContext.variables !== nextState.prevPropsContext.variables) {
return true;
}
} else {
if (!fragments.hasOwnProperty(key) && !isScalarAndEqual(nextProps[key], this.props[key])) {
return true;
}
}
}
return false;
},
componentDidUpdate: function componentDidUpdate(_, prevState) {
// Otherwise, for convenience short-circuit if all non-Relay props
// are scalar and equal
const keys = Object.keys(nextProps);
for (let ii = 0; ii < keys.length; ii++) {
const key = keys[ii];
if (key === '__relayContext') {
if (
this.state.prevPropsContext.environment !==
nextState.prevPropsContext.environment
) {
return true;
}
} else {
if (
!fragments.hasOwnProperty(key) &&
!isScalarAndEqual(nextProps[key], this.props[key])
) {
return true;
}
}
}
return false;
}
return true;
} // Otherwise, for convenience short-circuit if all non-Relay props
// are scalar and equal
var keys = Object.keys(nextProps);
for (var ii = 0; ii < keys.length; ii++) {
var key = keys[ii];
if (key === '__relayContext') {
if (nextState.prevPropsContext.environment !== this.state.prevPropsContext.environment || nextState.prevPropsContext.variables !== this.state.prevPropsContext.variables) {
return true;
}
} else {
if (!fragments.hasOwnProperty(key) && !relayRuntime.isScalarAndEqual(nextProps[key], this.props[key])) {
return true;
}
}
}
return false;
},
componentDidUpdate: function componentDidUpdate() {},
function isQueryDataEqual(
fragmentPointers: Object,
currProp: mixed,
nextProp: mixed,
propName: string,
): boolean {
return (
// resolved data did not change
(fragmentPointers[propName] && currProp === nextProp) ||
// otherwise compare fake data
isScalarAndEqual(currProp, nextProp)
);
}
forEachObject(this._resolvers, (resolver, key) => {
const prevItem = prevData[key];
if (resolver) {
const nextItem = resolver.resolve();
if (nextData || nextItem !== prevItem) {
nextData = nextData || {...prevData};
nextData[key] = nextItem;
}
} else {
const prop = this._props[key];
const nextItem = prop !== undefined ? prop : null;
if (nextData || !isScalarAndEqual(nextItem, prevItem)) {
nextData = nextData || {...prevData};
nextData[key] = nextItem;
}
}
});
this._data = nextData || prevData;
forEachObject(this._resolvers, (resolver, key) => {
const prevItem = prevData[key];
if (resolver) {
const nextItem = resolver.resolve();
if (nextData || nextItem !== prevItem) {
nextData = nextData || {...prevData};
nextData[key] = nextItem;
}
} else {
const prop = this._props[key];
const nextItem = prop !== undefined ? prop : null;
if (nextData || !isScalarAndEqual(nextItem, prevItem)) {
nextData = nextData || {...prevData};
nextData[key] = nextItem;
}
}
});
this._data = nextData || prevData;