MCPcopy Create free account
hub / github.com/plotly/dash / checkShouldComponentUpdate

Function checkShouldComponentUpdate

dash/deps/react-dom@18.3.1.js:17998–18029  ·  view source on GitHub ↗
(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext)

Source from the content-addressed store, hash-verified

17996 };
17997
17998 function checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext) {
17999 var instance = workInProgress.stateNode;
18000
18001 if (typeof instance.shouldComponentUpdate === 'function') {
18002 var shouldUpdate = instance.shouldComponentUpdate(newProps, newState, nextContext);
18003
18004 {
18005 if ( workInProgress.mode & StrictLegacyMode) {
18006 setIsStrictModeForDevtools(true);
18007
18008 try {
18009 // Invoke the function an extra time to help detect side-effects.
18010 shouldUpdate = instance.shouldComponentUpdate(newProps, newState, nextContext);
18011 } finally {
18012 setIsStrictModeForDevtools(false);
18013 }
18014 }
18015
18016 if (shouldUpdate === undefined) {
18017 error('%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', getComponentNameFromType(ctor) || 'Component');
18018 }
18019 }
18020
18021 return shouldUpdate;
18022 }
18023
18024 if (ctor.prototype && ctor.prototype.isPureReactComponent) {
18025 return !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState);
18026 }
18027
18028 return true;
18029 }
18030
18031 function checkClassInstance(workInProgress, ctor, newProps) {
18032 var instance = workInProgress.stateNode;

Callers 2

resumeMountClassInstanceFunction · 0.70
updateClassInstanceFunction · 0.70

Calls 5

errorFunction · 0.70
getComponentNameFromTypeFunction · 0.70
shallowEqualFunction · 0.70
shouldComponentUpdateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…