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

Function checkShouldComponentUpdate

code/new-context-api/public/app.js:7633–7658  ·  view source on GitHub ↗
(workInProgress, oldProps, newProps, oldState, newState, newContext)

Source from the content-addressed store, hash-verified

7631 };
7632
7633 function checkShouldComponentUpdate(workInProgress, oldProps, newProps, oldState, newState, newContext) {
7634 if (oldProps === null || workInProgress.updateQueue !== null && workInProgress.updateQueue.hasForceUpdate) {
7635 // If the workInProgress already has an Update effect, return true
7636 return true;
7637 }
7638
7639 var instance = workInProgress.stateNode;
7640 var ctor = workInProgress.type;
7641 if (typeof instance.shouldComponentUpdate === 'function') {
7642 startPhaseTimer(workInProgress, 'shouldComponentUpdate');
7643 var shouldUpdate = instance.shouldComponentUpdate(newProps, newState, newContext);
7644 stopPhaseTimer();
7645
7646 {
7647 warning(shouldUpdate !== undefined, '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', getComponentName(workInProgress) || 'Component');
7648 }
7649
7650 return shouldUpdate;
7651 }
7652
7653 if (ctor.prototype && ctor.prototype.isPureReactComponent) {
7654 return !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState);
7655 }
7656
7657 return true;
7658 }
7659
7660 function checkClassInstance(workInProgress) {
7661 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