MCPcopy Index your code
hub / github.com/microsoft/SandDance / checkShouldComponentUpdate

Function checkShouldComponentUpdate

docs/external/js/react-dom.development.js:12817–12846  ·  view source on GitHub ↗
(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext)

Source from the content-addressed store, hash-verified

12815 };
12816
12817 function checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext) {
12818 var instance = workInProgress.stateNode;
12819
12820 if (typeof instance.shouldComponentUpdate === 'function') {
12821 {
12822 if ( workInProgress.mode & StrictMode) {
12823 // Invoke the function an extra time to help detect side-effects.
12824 instance.shouldComponentUpdate(newProps, newState, nextContext);
12825 }
12826 }
12827
12828 startPhaseTimer(workInProgress, 'shouldComponentUpdate');
12829 var shouldUpdate = instance.shouldComponentUpdate(newProps, newState, nextContext);
12830 stopPhaseTimer();
12831
12832 {
12833 if (shouldUpdate === undefined) {
12834 error('%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', getComponentName(ctor) || 'Component');
12835 }
12836 }
12837
12838 return shouldUpdate;
12839 }
12840
12841 if (ctor.prototype && ctor.prototype.isPureReactComponent) {
12842 return !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState);
12843 }
12844
12845 return true;
12846 }
12847
12848 function checkClassInstance(workInProgress, ctor, newProps) {
12849 var instance = workInProgress.stateNode;

Callers 2

resumeMountClassInstanceFunction · 0.85
updateClassInstanceFunction · 0.85

Calls 5

startPhaseTimerFunction · 0.85
stopPhaseTimerFunction · 0.85
shallowEqualFunction · 0.85
errorFunction · 0.70
getComponentNameFunction · 0.70

Tested by

no test coverage detected