MCPcopy Index your code
hub / github.com/krasimir/react-in-patterns / checkShouldComponentUpdate

Function checkShouldComponentUpdate

code/composition/public/app.js:8410–8435  ·  view source on GitHub ↗
(workInProgress, oldProps, newProps, oldState, newState, newContext)

Source from the content-addressed store, hash-verified

8408 };
8409
8410 function checkShouldComponentUpdate(workInProgress, oldProps, newProps, oldState, newState, newContext) {
8411 if (oldProps === null || workInProgress.updateQueue !== null && workInProgress.updateQueue.hasForceUpdate) {
8412 // If the workInProgress already has an Update effect, return true
8413 return true;
8414 }
8415
8416 var instance = workInProgress.stateNode;
8417 var ctor = workInProgress.type;
8418 if (typeof instance.shouldComponentUpdate === 'function') {
8419 startPhaseTimer(workInProgress, 'shouldComponentUpdate');
8420 var shouldUpdate = instance.shouldComponentUpdate(newProps, newState, newContext);
8421 stopPhaseTimer();
8422
8423 {
8424 warning(shouldUpdate !== undefined, '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', getComponentName(workInProgress) || 'Component');
8425 }
8426
8427 return shouldUpdate;
8428 }
8429
8430 if (ctor.prototype && ctor.prototype.isPureReactComponent) {
8431 return !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState);
8432 }
8433
8434 return true;
8435 }
8436
8437 function checkClassInstance(workInProgress) {
8438 var instance = workInProgress.stateNode;

Callers 2

resumeMountClassInstanceFunction · 0.70
updateClassInstanceFunction · 0.70

Calls 6

warningFunction · 0.85
shouldComponentUpdateMethod · 0.80
startPhaseTimerFunction · 0.70
stopPhaseTimerFunction · 0.70
getComponentNameFunction · 0.70
shallowEqualFunction · 0.70

Tested by

no test coverage detected