@welldone-software/why-did-you-render
Advanced tools
Comparing version 3.3.2 to 3.3.3
/** | ||
* @welldone-software/why-did-you-render 3.3.2 | ||
* @welldone-software/why-did-you-render 3.3.3 | ||
* MIT Licensed | ||
* Generated by Vitali Zaidman <vzaidman@gmail.com> (https://github.com/vzaidman) | ||
* Generated at 2019-08-09 | ||
* Generated at 2019-08-13 | ||
*/ | ||
@@ -599,3 +599,3 @@ | ||
// copied from https://github.com/facebook/react/blob/master/packages/react-reconciler/src/ReactTypeOfMode.js | ||
var StrictMode = 2; // based on "findStrictRoot" from https://github.com/facebook/react/blob/master/packages/react-reconciler/src/ReactStrictModeWarnings.js | ||
var StrictMode = 1; // based on "findStrictRoot" from https://github.com/facebook/react/blob/master/packages/react-reconciler/src/ReactStrictModeWarnings.js | ||
// notice: this is only used for class components. functional components doesn't re-rendered inside strict mode | ||
@@ -606,3 +606,3 @@ | ||
while (reactInternalFiber) { | ||
while (reactInternalFiber !== null) { | ||
if (reactInternalFiber.mode & StrictMode) { | ||
@@ -609,0 +609,0 @@ return true; |
/** | ||
* @welldone-software/why-did-you-render 3.3.2 | ||
* @welldone-software/why-did-you-render 3.3.3 | ||
* MIT Licensed | ||
* Generated by Vitali Zaidman <vzaidman@gmail.com> (https://github.com/vzaidman) | ||
* Generated at 2019-08-09 | ||
* Generated at 2019-08-13 | ||
*/ | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var _mapValues=_interopDefault(require("lodash/mapValues")),_get$1=_interopDefault(require("lodash/get")),_isString=_interopDefault(require("lodash/isString")),_reduce=_interopDefault(require("lodash/reduce")),_has=_interopDefault(require("lodash/has")),_keys=_interopDefault(require("lodash/keys")),_isFunction=_interopDefault(require("lodash/isFunction")),_isRegExp=_interopDefault(require("lodash/isRegExp")),_isDate=_interopDefault(require("lodash/isDate")),_isPlainObject=_interopDefault(require("lodash/isPlainObject")),_isArray=_interopDefault(require("lodash/isArray")),_defaults=_interopDefault(require("lodash/defaults"));function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,o)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(r,!0).forEach(function(t){_defineProperty(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _possibleConstructorReturn(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?_assertThisInitialized(e):t}function _superPropBase(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf(e)););return e}function _get(e,t,r){return(_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var o=_superPropBase(e,t);if(o){var n=Object.getOwnPropertyDescriptor(o,t);return n.get?n.get.call(r):n.value}})(e,t,r||e)}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}function _iterableToArray(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance")}var _diffTypesDescription,diffTypes={different:"different",deepEquals:"deepEquals",date:"date",regex:"regex",reactElement:"reactElement",function:"function"},hasSymbol="function"==typeof Symbol&&Symbol.for,REACT_MEMO_TYPE=hasSymbol?Symbol.for("react.memo"):60115,REACT_FORWARD_REF_TYPE=hasSymbol?Symbol.for("react.forward_ref"):60112,moreInfoUrl="http://bit.ly/wdyr02",moreInfoHooksUrl="http://bit.ly/wdyr3",diffTypesDescriptions=(_defineProperty(_diffTypesDescription={},diffTypes.different,"different objects."),_defineProperty(_diffTypesDescription,diffTypes.deepEquals,"different objects that are equal by value."),_defineProperty(_diffTypesDescription,diffTypes.date,"different date objects with the same value."),_defineProperty(_diffTypesDescription,diffTypes.regex,"different regular expressions with the same value."),_defineProperty(_diffTypesDescription,diffTypes.reactElement,"different React elements with the same displayName."),_defineProperty(_diffTypesDescription,diffTypes.function,"different functions with the same name."),_diffTypesDescription),inHotReload=!1;function shouldLog(e,t,r){return!inHotReload&&(!!r.logOnDifferentValues||(!(!t.whyDidYouRender||!t.whyDidYouRender.logOnDifferentValues)||!(e.propsDifferences&&e.propsDifferences.some(function(e){return e.diffType===diffTypes.different})||e.stateDifferences&&e.stateDifferences.some(function(e){return e.diffType===diffTypes.different})||e.hookDifferences&&e.hookDifferences.some(function(e){return e.diffType===diffTypes.different}))))}function logDifference(e){var t=e.Component,r=e.displayName,o=e.hookName,n=e.prefixMessage,i=e.diffObjType,a=e.differences,f=e.values,s=e.options;a&&a.length>0?(s.consoleLog(_defineProperty({},r,t),"".concat(n," of ").concat(i," changes:")),a.forEach(function(e){var t=e.pathString,r=e.diffType,n=e.prevValue,a=e.nextValue;s.consoleGroup("%c".concat("hook"===i?"[hook ".concat(o," result]"):"".concat(i,"."),"%c").concat(t,"%c"),"color:".concat(s.diffNameColor,";"),"color:".concat(s.diffPathColor,";"),"color:default;"),s.consoleLog("".concat(diffTypesDescriptions[r]," (more info at ").concat(o?moreInfoHooksUrl:moreInfoUrl,")")),s.consoleLog(_defineProperty({},"prev ".concat(t),n),"!==",_defineProperty({},"next ".concat(t),a)),s.consoleGroupEnd()})):a&&(s.consoleLog(_defineProperty({},r,t),"".concat(n," the ").concat(i," object itself changed but its values are all equal."),"props"===i?"This could have been avoided by making the component pure, or by preventing its father from re-rendering.":"This usually means this component called setState when no changes in its state actually occurred.","More info at ".concat(moreInfoUrl)),s.consoleLog("prev ".concat(i,":"),f.prev," !== ",f.next,":next ".concat(i)))}function defaultNotifier(e){var t=e.Component,r=e.displayName,o=e.hookName,n=e.prevProps,i=e.prevState,a=e.prevHook,f=e.nextProps,s=e.nextState,c=e.nextHook,p=e.reason,u=e.options;if(shouldLog(p,t,u)){u.consoleGroup("%c".concat(r),"color: ".concat(u.titleColor,";"));var l="Re-rendered because";p.propsDifferences&&(logDifference({Component:t,displayName:r,prefixMessage:l,diffObjType:"props",differences:p.propsDifferences,values:{prev:n,next:f},options:u}),l="And because"),p.stateDifferences&&logDifference({Component:t,displayName:r,prefixMessage:l,diffObjType:"state",differences:p.stateDifferences,values:{prev:i,next:s},options:u}),p.hookDifferences&&logDifference({Component:t,displayName:r,prefixMessage:l,diffObjType:"hook",differences:p.hookDifferences,values:{prev:a,next:c},hookName:o,options:u}),p.propsDifferences||p.stateDifferences||p.hookDifferences||u.consoleLog(_defineProperty({},r,t),"Re-rendered although props and state objects are the same.","This usually means there was a call to this.forceUpdate() inside the component.","more info at ".concat(moreInfoUrl)),u.consoleGroupEnd()}}function createDefaultNotifier(e){return e&&module&&module.hot&&module.hot.addStatusHandler&&module.hot.addStatusHandler(function(t){"idle"===t&&(inHotReload=!0,setTimeout(function(){inHotReload=!1},e))}),defaultNotifier}var emptyFn=function(){};function normalizeOptions(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=console.group,r=console.groupEnd;return e.collapseGroups?t=console.groupCollapsed:e.onlyLogs&&(t=console.log,r=emptyFn),_objectSpread2({include:null,exclude:null,notifier:e.notifier||createDefaultNotifier("hotReloadBufferMs"in e?e.hotReloadBufferMs:500),onlyLogs:!1,consoleLog:console.log,consoleGroup:t,consoleGroupEnd:r,logOnDifferentValues:!1,trackHooks:!0,titleColor:"#058",diffNameColor:"blue",diffPathColor:"red"},e)}function getDisplayName(e){return e.displayName||e.name||e.type&&getDisplayName(e.type)||e.render&&getDisplayName(e.render)||(_isString(e)?e:void 0)}var hasElementType="undefined"!=typeof Element,hasSymbol$1="function"==typeof Symbol&&Symbol.for,REACT_ELEMENT_TYPE=hasSymbol$1?Symbol.for("react.element"):60103,isReactElement=function(e){return e.$$typeof===REACT_ELEMENT_TYPE};function trackDiff(e,t,r,o,n){return r.push({diffType:n,pathString:o,prevValue:e,nextValue:t}),n!==diffTypes.different}function accumulateDeepEqualDiffs(e,t,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";if(e===t)return!0;if(!e||!t)return trackDiff(e,t,r,o,diffTypes.different);if(_isArray(e)&&_isArray(t)){var n=e.length;if(n!==t.length)return trackDiff(e,t,r,o,diffTypes.different);for(var i=!0,a=n;0!=a--;)accumulateDeepEqualDiffs(e[a],t[a],r,"".concat(o,"[").concat(a,"]"))||(i=!1);return trackDiff(e,t,r,o,i?diffTypes.deepEquals:diffTypes.different)}if(_isDate(e)&&_isDate(t))return e.getTime()===t.getTime()?trackDiff(e,t,r,o,diffTypes.date):trackDiff(e,t,r,o,diffTypes.different);if(_isRegExp(e)&&_isRegExp(t))return e.toString()===t.toString()?trackDiff(e,t,r,o,diffTypes.regex):trackDiff(e,t,r,o,diffTypes.different);if(hasElementType&&e instanceof Element&&t instanceof Element)return trackDiff(e,t,r,o,diffTypes.different);if(isReactElement(e)&&isReactElement(t))return e.type!==t.type?trackDiff(e,t,r,o,diffTypes.different):trackDiff(e,t,r,o,accumulateDeepEqualDiffs(e.props,t.props,r,"".concat(o,".props"))?diffTypes.reactElement:diffTypes.different);if(_isFunction(e)&&_isFunction(t))return e.name===t.name?trackDiff(e,t,r,o,diffTypes.function):trackDiff(e,t,r,o,diffTypes.different);if(_isPlainObject(e)&&_isPlainObject(t)){var f=_keys(e),s=f.length;if(s!==_keys(t).length)return trackDiff(e,t,r,o,diffTypes.different);for(var c=s;0!=c--;)if(!_has(t,f[c]))return trackDiff(e,t,r,o,diffTypes.different);for(var p=!0,u=s;0!=u--;){var l=f[u];accumulateDeepEqualDiffs(e[l],t[l],r,"".concat(o,".").concat(l))||(p=!1)}return trackDiff(e,t,r,o,p?diffTypes.deepEquals:diffTypes.different)}return trackDiff(e,t,r,o,diffTypes.different)}function calculateDeepEqualDiffs(e,t,r){try{var o=[];return accumulateDeepEqualDiffs(e,t,o,r),o}catch(e){if(e.message&&e.message.match(/stack|recursion/i)||-2146828260===e.number)return console.warn("Warning: why-did-you-render couldn't handle circular references in props.",e.name,e.message),!1;throw e}}var emptyObject={};function findObjectsDifferences(e,t){var r=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).shallow;if(e===t)return!1;if(!(void 0===r||r))return calculateDeepEqualDiffs(e,t);var o=e||emptyObject,n=t||emptyObject,i=Object.keys(_objectSpread2({},o,{},n));return _reduce(i,function(e,t){var r=calculateDeepEqualDiffs(o[t],n[t],t);return r&&(e=[].concat(_toConsumableArray(e),_toConsumableArray(r))),e},[])}function getUpdateReason(e,t,r,o,n,i){return{propsDifferences:findObjectsDifferences(e,o),stateDifferences:findObjectsDifferences(t,n),hookDifferences:findObjectsDifferences(r,i,{shallow:!1})}}function getUpdateInfo(e){var t=e.Component,r=e.displayName,o=e.hookName,n=e.prevProps,i=e.prevState,a=e.prevHook,f=e.nextProps,s=e.nextState,c=e.nextHook;return{Component:t,displayName:r,hookName:o,prevProps:n,prevState:i,prevHook:a,nextProps:f,nextState:s,nextHook:c,options:e.options,reason:getUpdateReason(n,i,a,f,s,c)}}function shouldInclude(e,t){return t.include&&t.include.length>0&&t.include.some(function(t){return t.test(e)})}function shouldExclude(e,t){return t.exclude&&t.exclude.length>0&&t.exclude.some(function(t){return t.test(e)})}function shouldTrack(e,t,r){return!shouldExclude(t,r)&&!(!e.whyDidYouRender&&!shouldInclude(t,r))}var StrictMode=2;function checkIfInsideAStrictModeTree(e){for(var t=e._reactInternalFiber;t;){if(t.mode&StrictMode)return!0;t=t.return}return!1}function patchClassComponent(e,t,r,o){var n=function(r){function n(t,r){var o;_classCallCheck(this,n),(o=_possibleConstructorReturn(this,_getPrototypeOf(n).call(this,t,r)))._WDYR={renderNumber:0};var i=_get(_getPrototypeOf(n.prototype),"render",_assertThisInitialized(o))||o.render;return i!==e.prototype.render&&(o.render=function(){return n.prototype.render.apply(_assertThisInitialized(o)),i()}),o}return _inherits(n,e),_createClass(n,[{key:"render",value:function(){return this._WDYR.renderNumber++,"isStrictMode"in this._WDYR||(this._WDYR.isStrictMode=checkIfInsideAStrictModeTree(this)),this._WDYR.isStrictMode&&this._WDYR.renderNumber%2==1||(this._WDYR.prevProps&&o.notifier(getUpdateInfo({Component:e,displayName:t,prevProps:this._WDYR.prevProps,prevState:this._WDYR.prevState,nextProps:this.props,nextState:this.state,options:o})),this._WDYR.prevProps=this.props,this._WDYR.prevState=this.state),_get(_getPrototypeOf(n.prototype),"render",this)?_get(_getPrototypeOf(n.prototype),"render",this).call(this):null}}]),n}();return n.displayName=t,_defaults(n,e),n}function patchFunctionalComponent(e,t,r,o){function n(n){var i=r.useRef(),a=i.current;if(i.current=n,a){var f=getUpdateInfo({Component:e,displayName:t,prevProps:a,nextProps:n,options:o});f.reason.propsDifferences&&o.notifier(f)}return e(n)}return n.displayName=t,n.ComponentForHooksTracking=e,_defaults(n,e),n}function patchMemoComponent(e,t,r,o){var n=e.type,i=n.$$typeof===REACT_FORWARD_REF_TYPE,a=i?n.render:n;function f(){var n=arguments[0],i=r.useRef(),f=i.current;if(i.current=n,f){var s=getUpdateInfo({Component:e,displayName:t,prevProps:f,nextProps:n,options:o});s.reason.propsDifferences&&s.reason.propsDifferences.length>0&&o.notifier(s)}return a.apply(void 0,arguments)}f.displayName=getDisplayName(a),f.ComponentForHooksTracking=e,_defaults(f,a);var s=r.memo(i?r.forwardRef(f):f,e.compare);return s.displayName=t,_defaults(s,e),s}function patchForwardRefComponent(e,t,r,o){var n=e.render,i=n.$$typeof===REACT_MEMO_TYPE,a=i?n.type:n;function f(){var n=arguments[0],i=r.useRef(),f=i.current;if(i.current=n,f){var s=getUpdateInfo({Component:e,displayName:t,prevProps:f,nextProps:n,options:o});s.reason.propsDifferences&&s.reason.propsDifferences.length>0&&o.notifier(s)}return a.apply(void 0,arguments)}f.displayName=getDisplayName(a),f.ComponentForHooksTracking=a,_defaults(f,a);var s=r.forwardRef(i?r.memo(f,n.compare):f);return s.displayName=t,_defaults(s,e),s}function trackHookChanges(e,t,r,o,n){var i=t.path,a=r,f=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner.current;if(!f)return a;var s=f.type.ComponentForHooksTracking||f.type,c=getDisplayName(s);if(!shouldTrack(s,c,n))return a;var p=o.useRef(),u=p.current;if(p.current=a,u){var l=getUpdateInfo({Component:s,displayName:c,hookName:e,prevHook:i?_get$1(u,i):u,nextHook:i?_get$1(a,i):a,options:n});l.reason.hookDifferences&&n.notifier(l)}return p.current}function createPatchedComponent(e,t,r,o,n){return t.$$typeof===REACT_MEMO_TYPE?patchMemoComponent(t,r,o,n):t.$$typeof===REACT_FORWARD_REF_TYPE?patchForwardRefComponent(t,r,o,n):t.prototype&&t.prototype.isReactComponent?patchClassComponent(t,r,o,n):patchFunctionalComponent(t,r,o,n)}function getPatchedComponent(e,t,r,o,n){if(e.has(t))return e.get(t);var i=createPatchedComponent(e,t,r,o,n);return e.set(t,i),i}var hooksConfig={useState:{path:"0"},useReducer:{path:"0"},useContext:!0,useMemo:!0};function whyDidYouRender(e,t){var r,o=normalizeOptions(t),n=e.createElement,i=e.createFactory,a=new WeakMap;if(e.createElement=function(t){for(var r=null,i=null,f=null,s=arguments.length,c=new Array(s>1?s-1:0),p=1;p<s;p++)c[p-1]=arguments[p];try{if(r=("function"==typeof t||t.$$typeof===REACT_MEMO_TYPE||t.$$typeof===REACT_FORWARD_REF_TYPE)&&shouldTrack(t,getDisplayName(t),o))return i=t&&t.whyDidYouRender&&t.whyDidYouRender.customName||getDisplayName(t),f=getPatchedComponent(a,t,i,e,o),n.apply(e,[f].concat(c))}catch(e){o.consoleLog("whyDidYouRender error. Please file a bug at https://github.com/welldone-software/why-did-you-render/issues.",{errorInfo:{error:e,componentNameOrComponent:t,rest:c,options:o,isShouldTrack:r,displayName:i,WDYRPatchedComponent:f}})}return n.apply(e,[t].concat(c))},Object.assign(e.createElement,n),e.createFactory=function(t){var r=e.createElement.bind(null,t);return r.type=t,r},Object.assign(e.createFactory,i),o.trackHooks){var f=_mapValues(hooksConfig,function(t,n){return function(){var i=r[n];if(!i)throw new Error("[WhyDidYouRender] A problem with React Hooks patching occurred.");var a=i.apply(void 0,arguments);return t&&trackHookChanges(n,!0===t?{}:t,a,e,o),a}});Object.defineProperty(e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher,"current",{set:function(e){r=e&&_objectSpread2({},e,{},e.origHooks)},get:function(){return r&&_objectSpread2({},r,{},f,{origHooks:r})}})}return e.__REVERT_WHY_DID_YOU_RENDER__=function(){Object.assign(e,{createElement:n,createFactory:i}),a=null,Object.defineProperty(e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher,"current",{writable:!0,value:r}),delete e.__REVERT_WHY_DID_YOU_RENDER__},e}whyDidYouRender.defaultNotifier=defaultNotifier,module.exports=whyDidYouRender; | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var _mapValues=_interopDefault(require("lodash/mapValues")),_get$1=_interopDefault(require("lodash/get")),_isString=_interopDefault(require("lodash/isString")),_reduce=_interopDefault(require("lodash/reduce")),_has=_interopDefault(require("lodash/has")),_keys=_interopDefault(require("lodash/keys")),_isFunction=_interopDefault(require("lodash/isFunction")),_isRegExp=_interopDefault(require("lodash/isRegExp")),_isDate=_interopDefault(require("lodash/isDate")),_isPlainObject=_interopDefault(require("lodash/isPlainObject")),_isArray=_interopDefault(require("lodash/isArray")),_defaults=_interopDefault(require("lodash/defaults"));function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,o)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(r,!0).forEach(function(t){_defineProperty(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _possibleConstructorReturn(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?_assertThisInitialized(e):t}function _superPropBase(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf(e)););return e}function _get(e,t,r){return(_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var o=_superPropBase(e,t);if(o){var n=Object.getOwnPropertyDescriptor(o,t);return n.get?n.get.call(r):n.value}})(e,t,r||e)}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}function _iterableToArray(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance")}var _diffTypesDescription,diffTypes={different:"different",deepEquals:"deepEquals",date:"date",regex:"regex",reactElement:"reactElement",function:"function"},hasSymbol="function"==typeof Symbol&&Symbol.for,REACT_MEMO_TYPE=hasSymbol?Symbol.for("react.memo"):60115,REACT_FORWARD_REF_TYPE=hasSymbol?Symbol.for("react.forward_ref"):60112,moreInfoUrl="http://bit.ly/wdyr02",moreInfoHooksUrl="http://bit.ly/wdyr3",diffTypesDescriptions=(_defineProperty(_diffTypesDescription={},diffTypes.different,"different objects."),_defineProperty(_diffTypesDescription,diffTypes.deepEquals,"different objects that are equal by value."),_defineProperty(_diffTypesDescription,diffTypes.date,"different date objects with the same value."),_defineProperty(_diffTypesDescription,diffTypes.regex,"different regular expressions with the same value."),_defineProperty(_diffTypesDescription,diffTypes.reactElement,"different React elements with the same displayName."),_defineProperty(_diffTypesDescription,diffTypes.function,"different functions with the same name."),_diffTypesDescription),inHotReload=!1;function shouldLog(e,t,r){return!inHotReload&&(!!r.logOnDifferentValues||(!(!t.whyDidYouRender||!t.whyDidYouRender.logOnDifferentValues)||!(e.propsDifferences&&e.propsDifferences.some(function(e){return e.diffType===diffTypes.different})||e.stateDifferences&&e.stateDifferences.some(function(e){return e.diffType===diffTypes.different})||e.hookDifferences&&e.hookDifferences.some(function(e){return e.diffType===diffTypes.different}))))}function logDifference(e){var t=e.Component,r=e.displayName,o=e.hookName,n=e.prefixMessage,i=e.diffObjType,a=e.differences,f=e.values,s=e.options;a&&a.length>0?(s.consoleLog(_defineProperty({},r,t),"".concat(n," of ").concat(i," changes:")),a.forEach(function(e){var t=e.pathString,r=e.diffType,n=e.prevValue,a=e.nextValue;s.consoleGroup("%c".concat("hook"===i?"[hook ".concat(o," result]"):"".concat(i,"."),"%c").concat(t,"%c"),"color:".concat(s.diffNameColor,";"),"color:".concat(s.diffPathColor,";"),"color:default;"),s.consoleLog("".concat(diffTypesDescriptions[r]," (more info at ").concat(o?moreInfoHooksUrl:moreInfoUrl,")")),s.consoleLog(_defineProperty({},"prev ".concat(t),n),"!==",_defineProperty({},"next ".concat(t),a)),s.consoleGroupEnd()})):a&&(s.consoleLog(_defineProperty({},r,t),"".concat(n," the ").concat(i," object itself changed but its values are all equal."),"props"===i?"This could have been avoided by making the component pure, or by preventing its father from re-rendering.":"This usually means this component called setState when no changes in its state actually occurred.","More info at ".concat(moreInfoUrl)),s.consoleLog("prev ".concat(i,":"),f.prev," !== ",f.next,":next ".concat(i)))}function defaultNotifier(e){var t=e.Component,r=e.displayName,o=e.hookName,n=e.prevProps,i=e.prevState,a=e.prevHook,f=e.nextProps,s=e.nextState,c=e.nextHook,p=e.reason,u=e.options;if(shouldLog(p,t,u)){u.consoleGroup("%c".concat(r),"color: ".concat(u.titleColor,";"));var l="Re-rendered because";p.propsDifferences&&(logDifference({Component:t,displayName:r,prefixMessage:l,diffObjType:"props",differences:p.propsDifferences,values:{prev:n,next:f},options:u}),l="And because"),p.stateDifferences&&logDifference({Component:t,displayName:r,prefixMessage:l,diffObjType:"state",differences:p.stateDifferences,values:{prev:i,next:s},options:u}),p.hookDifferences&&logDifference({Component:t,displayName:r,prefixMessage:l,diffObjType:"hook",differences:p.hookDifferences,values:{prev:a,next:c},hookName:o,options:u}),p.propsDifferences||p.stateDifferences||p.hookDifferences||u.consoleLog(_defineProperty({},r,t),"Re-rendered although props and state objects are the same.","This usually means there was a call to this.forceUpdate() inside the component.","more info at ".concat(moreInfoUrl)),u.consoleGroupEnd()}}function createDefaultNotifier(e){return e&&module&&module.hot&&module.hot.addStatusHandler&&module.hot.addStatusHandler(function(t){"idle"===t&&(inHotReload=!0,setTimeout(function(){inHotReload=!1},e))}),defaultNotifier}var emptyFn=function(){};function normalizeOptions(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=console.group,r=console.groupEnd;return e.collapseGroups?t=console.groupCollapsed:e.onlyLogs&&(t=console.log,r=emptyFn),_objectSpread2({include:null,exclude:null,notifier:e.notifier||createDefaultNotifier("hotReloadBufferMs"in e?e.hotReloadBufferMs:500),onlyLogs:!1,consoleLog:console.log,consoleGroup:t,consoleGroupEnd:r,logOnDifferentValues:!1,trackHooks:!0,titleColor:"#058",diffNameColor:"blue",diffPathColor:"red"},e)}function getDisplayName(e){return e.displayName||e.name||e.type&&getDisplayName(e.type)||e.render&&getDisplayName(e.render)||(_isString(e)?e:void 0)}var hasElementType="undefined"!=typeof Element,hasSymbol$1="function"==typeof Symbol&&Symbol.for,REACT_ELEMENT_TYPE=hasSymbol$1?Symbol.for("react.element"):60103,isReactElement=function(e){return e.$$typeof===REACT_ELEMENT_TYPE};function trackDiff(e,t,r,o,n){return r.push({diffType:n,pathString:o,prevValue:e,nextValue:t}),n!==diffTypes.different}function accumulateDeepEqualDiffs(e,t,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";if(e===t)return!0;if(!e||!t)return trackDiff(e,t,r,o,diffTypes.different);if(_isArray(e)&&_isArray(t)){var n=e.length;if(n!==t.length)return trackDiff(e,t,r,o,diffTypes.different);for(var i=!0,a=n;0!=a--;)accumulateDeepEqualDiffs(e[a],t[a],r,"".concat(o,"[").concat(a,"]"))||(i=!1);return trackDiff(e,t,r,o,i?diffTypes.deepEquals:diffTypes.different)}if(_isDate(e)&&_isDate(t))return e.getTime()===t.getTime()?trackDiff(e,t,r,o,diffTypes.date):trackDiff(e,t,r,o,diffTypes.different);if(_isRegExp(e)&&_isRegExp(t))return e.toString()===t.toString()?trackDiff(e,t,r,o,diffTypes.regex):trackDiff(e,t,r,o,diffTypes.different);if(hasElementType&&e instanceof Element&&t instanceof Element)return trackDiff(e,t,r,o,diffTypes.different);if(isReactElement(e)&&isReactElement(t))return e.type!==t.type?trackDiff(e,t,r,o,diffTypes.different):trackDiff(e,t,r,o,accumulateDeepEqualDiffs(e.props,t.props,r,"".concat(o,".props"))?diffTypes.reactElement:diffTypes.different);if(_isFunction(e)&&_isFunction(t))return e.name===t.name?trackDiff(e,t,r,o,diffTypes.function):trackDiff(e,t,r,o,diffTypes.different);if(_isPlainObject(e)&&_isPlainObject(t)){var f=_keys(e),s=f.length;if(s!==_keys(t).length)return trackDiff(e,t,r,o,diffTypes.different);for(var c=s;0!=c--;)if(!_has(t,f[c]))return trackDiff(e,t,r,o,diffTypes.different);for(var p=!0,u=s;0!=u--;){var l=f[u];accumulateDeepEqualDiffs(e[l],t[l],r,"".concat(o,".").concat(l))||(p=!1)}return trackDiff(e,t,r,o,p?diffTypes.deepEquals:diffTypes.different)}return trackDiff(e,t,r,o,diffTypes.different)}function calculateDeepEqualDiffs(e,t,r){try{var o=[];return accumulateDeepEqualDiffs(e,t,o,r),o}catch(e){if(e.message&&e.message.match(/stack|recursion/i)||-2146828260===e.number)return console.warn("Warning: why-did-you-render couldn't handle circular references in props.",e.name,e.message),!1;throw e}}var emptyObject={};function findObjectsDifferences(e,t){var r=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).shallow;if(e===t)return!1;if(!(void 0===r||r))return calculateDeepEqualDiffs(e,t);var o=e||emptyObject,n=t||emptyObject,i=Object.keys(_objectSpread2({},o,{},n));return _reduce(i,function(e,t){var r=calculateDeepEqualDiffs(o[t],n[t],t);return r&&(e=[].concat(_toConsumableArray(e),_toConsumableArray(r))),e},[])}function getUpdateReason(e,t,r,o,n,i){return{propsDifferences:findObjectsDifferences(e,o),stateDifferences:findObjectsDifferences(t,n),hookDifferences:findObjectsDifferences(r,i,{shallow:!1})}}function getUpdateInfo(e){var t=e.Component,r=e.displayName,o=e.hookName,n=e.prevProps,i=e.prevState,a=e.prevHook,f=e.nextProps,s=e.nextState,c=e.nextHook;return{Component:t,displayName:r,hookName:o,prevProps:n,prevState:i,prevHook:a,nextProps:f,nextState:s,nextHook:c,options:e.options,reason:getUpdateReason(n,i,a,f,s,c)}}function shouldInclude(e,t){return t.include&&t.include.length>0&&t.include.some(function(t){return t.test(e)})}function shouldExclude(e,t){return t.exclude&&t.exclude.length>0&&t.exclude.some(function(t){return t.test(e)})}function shouldTrack(e,t,r){return!shouldExclude(t,r)&&!(!e.whyDidYouRender&&!shouldInclude(t,r))}var StrictMode=1;function checkIfInsideAStrictModeTree(e){for(var t=e._reactInternalFiber;null!==t;){if(t.mode&StrictMode)return!0;t=t.return}return!1}function patchClassComponent(e,t,r,o){var n=function(r){function n(t,r){var o;_classCallCheck(this,n),(o=_possibleConstructorReturn(this,_getPrototypeOf(n).call(this,t,r)))._WDYR={renderNumber:0};var i=_get(_getPrototypeOf(n.prototype),"render",_assertThisInitialized(o))||o.render;return i!==e.prototype.render&&(o.render=function(){return n.prototype.render.apply(_assertThisInitialized(o)),i()}),o}return _inherits(n,e),_createClass(n,[{key:"render",value:function(){return this._WDYR.renderNumber++,"isStrictMode"in this._WDYR||(this._WDYR.isStrictMode=checkIfInsideAStrictModeTree(this)),this._WDYR.isStrictMode&&this._WDYR.renderNumber%2==1||(this._WDYR.prevProps&&o.notifier(getUpdateInfo({Component:e,displayName:t,prevProps:this._WDYR.prevProps,prevState:this._WDYR.prevState,nextProps:this.props,nextState:this.state,options:o})),this._WDYR.prevProps=this.props,this._WDYR.prevState=this.state),_get(_getPrototypeOf(n.prototype),"render",this)?_get(_getPrototypeOf(n.prototype),"render",this).call(this):null}}]),n}();return n.displayName=t,_defaults(n,e),n}function patchFunctionalComponent(e,t,r,o){function n(n){var i=r.useRef(),a=i.current;if(i.current=n,a){var f=getUpdateInfo({Component:e,displayName:t,prevProps:a,nextProps:n,options:o});f.reason.propsDifferences&&o.notifier(f)}return e(n)}return n.displayName=t,n.ComponentForHooksTracking=e,_defaults(n,e),n}function patchMemoComponent(e,t,r,o){var n=e.type,i=n.$$typeof===REACT_FORWARD_REF_TYPE,a=i?n.render:n;function f(){var n=arguments[0],i=r.useRef(),f=i.current;if(i.current=n,f){var s=getUpdateInfo({Component:e,displayName:t,prevProps:f,nextProps:n,options:o});s.reason.propsDifferences&&s.reason.propsDifferences.length>0&&o.notifier(s)}return a.apply(void 0,arguments)}f.displayName=getDisplayName(a),f.ComponentForHooksTracking=e,_defaults(f,a);var s=r.memo(i?r.forwardRef(f):f,e.compare);return s.displayName=t,_defaults(s,e),s}function patchForwardRefComponent(e,t,r,o){var n=e.render,i=n.$$typeof===REACT_MEMO_TYPE,a=i?n.type:n;function f(){var n=arguments[0],i=r.useRef(),f=i.current;if(i.current=n,f){var s=getUpdateInfo({Component:e,displayName:t,prevProps:f,nextProps:n,options:o});s.reason.propsDifferences&&s.reason.propsDifferences.length>0&&o.notifier(s)}return a.apply(void 0,arguments)}f.displayName=getDisplayName(a),f.ComponentForHooksTracking=a,_defaults(f,a);var s=r.forwardRef(i?r.memo(f,n.compare):f);return s.displayName=t,_defaults(s,e),s}function trackHookChanges(e,t,r,o,n){var i=t.path,a=r,f=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner.current;if(!f)return a;var s=f.type.ComponentForHooksTracking||f.type,c=getDisplayName(s);if(!shouldTrack(s,c,n))return a;var p=o.useRef(),u=p.current;if(p.current=a,u){var l=getUpdateInfo({Component:s,displayName:c,hookName:e,prevHook:i?_get$1(u,i):u,nextHook:i?_get$1(a,i):a,options:n});l.reason.hookDifferences&&n.notifier(l)}return p.current}function createPatchedComponent(e,t,r,o,n){return t.$$typeof===REACT_MEMO_TYPE?patchMemoComponent(t,r,o,n):t.$$typeof===REACT_FORWARD_REF_TYPE?patchForwardRefComponent(t,r,o,n):t.prototype&&t.prototype.isReactComponent?patchClassComponent(t,r,o,n):patchFunctionalComponent(t,r,o,n)}function getPatchedComponent(e,t,r,o,n){if(e.has(t))return e.get(t);var i=createPatchedComponent(e,t,r,o,n);return e.set(t,i),i}var hooksConfig={useState:{path:"0"},useReducer:{path:"0"},useContext:!0,useMemo:!0};function whyDidYouRender(e,t){var r,o=normalizeOptions(t),n=e.createElement,i=e.createFactory,a=new WeakMap;if(e.createElement=function(t){for(var r=null,i=null,f=null,s=arguments.length,c=new Array(s>1?s-1:0),p=1;p<s;p++)c[p-1]=arguments[p];try{if(r=("function"==typeof t||t.$$typeof===REACT_MEMO_TYPE||t.$$typeof===REACT_FORWARD_REF_TYPE)&&shouldTrack(t,getDisplayName(t),o))return i=t&&t.whyDidYouRender&&t.whyDidYouRender.customName||getDisplayName(t),f=getPatchedComponent(a,t,i,e,o),n.apply(e,[f].concat(c))}catch(e){o.consoleLog("whyDidYouRender error. Please file a bug at https://github.com/welldone-software/why-did-you-render/issues.",{errorInfo:{error:e,componentNameOrComponent:t,rest:c,options:o,isShouldTrack:r,displayName:i,WDYRPatchedComponent:f}})}return n.apply(e,[t].concat(c))},Object.assign(e.createElement,n),e.createFactory=function(t){var r=e.createElement.bind(null,t);return r.type=t,r},Object.assign(e.createFactory,i),o.trackHooks){var f=_mapValues(hooksConfig,function(t,n){return function(){var i=r[n];if(!i)throw new Error("[WhyDidYouRender] A problem with React Hooks patching occurred.");var a=i.apply(void 0,arguments);return t&&trackHookChanges(n,!0===t?{}:t,a,e,o),a}});Object.defineProperty(e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher,"current",{set:function(e){r=e&&_objectSpread2({},e,{},e.origHooks)},get:function(){return r&&_objectSpread2({},r,{},f,{origHooks:r})}})}return e.__REVERT_WHY_DID_YOU_RENDER__=function(){Object.assign(e,{createElement:n,createFactory:i}),a=null,Object.defineProperty(e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher,"current",{writable:!0,value:r}),delete e.__REVERT_WHY_DID_YOU_RENDER__},e}whyDidYouRender.defaultNotifier=defaultNotifier,module.exports=whyDidYouRender; | ||
//# sourceMappingURL=whyDidYouRender.min.js.map |
/** | ||
* @welldone-software/why-did-you-render 3.3.2 | ||
* @welldone-software/why-did-you-render 3.3.3 | ||
* MIT Licensed | ||
* Generated by Vitali Zaidman <vzaidman@gmail.com> (https://github.com/vzaidman) | ||
* Generated at 2019-08-09 | ||
* Generated at 2019-08-13 | ||
*/ | ||
@@ -595,3 +595,3 @@ | ||
// copied from https://github.com/facebook/react/blob/master/packages/react-reconciler/src/ReactTypeOfMode.js | ||
var StrictMode = 2; // based on "findStrictRoot" from https://github.com/facebook/react/blob/master/packages/react-reconciler/src/ReactStrictModeWarnings.js | ||
var StrictMode = 1; // based on "findStrictRoot" from https://github.com/facebook/react/blob/master/packages/react-reconciler/src/ReactStrictModeWarnings.js | ||
// notice: this is only used for class components. functional components doesn't re-rendered inside strict mode | ||
@@ -602,3 +602,3 @@ | ||
while (reactInternalFiber) { | ||
while (reactInternalFiber !== null) { | ||
if (reactInternalFiber.mode & StrictMode) { | ||
@@ -605,0 +605,0 @@ return true; |
/** | ||
* @welldone-software/why-did-you-render 3.3.2 | ||
* @welldone-software/why-did-you-render 3.3.3 | ||
* MIT Licensed | ||
* Generated by Vitali Zaidman <vzaidman@gmail.com> (https://github.com/vzaidman) | ||
* Generated at 2019-08-09 | ||
* Generated at 2019-08-13 | ||
*/ | ||
import e from"lodash/mapValues";import r from"lodash/get";import t from"lodash/isString";import n from"lodash/reduce";import o from"lodash/has";import i from"lodash/keys";import a from"lodash/isFunction";import f from"lodash/isRegExp";import c from"lodash/isDate";import s from"lodash/isPlainObject";import u from"lodash/isArray";import p from"lodash/defaults";function l(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function d(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function m(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function h(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?m(t,!0).forEach(function(r){d(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):m(t).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e,r){return(v=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e})(e,r)}function g(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function b(e,r,t){return(b="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,r,t){var n=function(e,r){for(;!Object.prototype.hasOwnProperty.call(e,r)&&null!==(e=y(e)););return e}(e,r);if(n){var o=Object.getOwnPropertyDescriptor(n,r);return o.get?o.get.call(t):o.value}})(e,r,t||e)}function _(e){return function(e){if(Array.isArray(e)){for(var r=0,t=new Array(e.length);r<e.length;r++)t[r]=e[r];return t}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var D,O={different:"different",deepEquals:"deepEquals",date:"date",regex:"regex",reactElement:"reactElement",function:"function"},R="function"==typeof Symbol&&Symbol.for,E=R?Symbol.for("react.memo"):60115,w=R?Symbol.for("react.forward_ref"):60112,k="http://bit.ly/wdyr02",N="http://bit.ly/wdyr3",S=(d(D={},O.different,"different objects."),d(D,O.deepEquals,"different objects that are equal by value."),d(D,O.date,"different date objects with the same value."),d(D,O.regex,"different regular expressions with the same value."),d(D,O.reactElement,"different React elements with the same displayName."),d(D,O.function,"different functions with the same name."),D),x=!1;function P(e){var r=e.Component,t=e.displayName,n=e.hookName,o=e.prefixMessage,i=e.diffObjType,a=e.differences,f=e.values,c=e.options;a&&a.length>0?(c.consoleLog(d({},t,r),"".concat(o," of ").concat(i," changes:")),a.forEach(function(e){var r=e.pathString,t=e.diffType,o=e.prevValue,a=e.nextValue;c.consoleGroup("%c".concat("hook"===i?"[hook ".concat(n," result]"):"".concat(i,"."),"%c").concat(r,"%c"),"color:".concat(c.diffNameColor,";"),"color:".concat(c.diffPathColor,";"),"color:default;"),c.consoleLog("".concat(S[t]," (more info at ").concat(n?N:k,")")),c.consoleLog(d({},"prev ".concat(r),o),"!==",d({},"next ".concat(r),a)),c.consoleGroupEnd()})):a&&(c.consoleLog(d({},t,r),"".concat(o," the ").concat(i," object itself changed but its values are all equal."),"props"===i?"This could have been avoided by making the component pure, or by preventing its father from re-rendering.":"This usually means this component called setState when no changes in its state actually occurred.","More info at ".concat(k)),c.consoleLog("prev ".concat(i,":"),f.prev," !== ",f.next,":next ".concat(i)))}function j(e){var r=e.Component,t=e.displayName,n=e.hookName,o=e.prevProps,i=e.prevState,a=e.prevHook,f=e.nextProps,c=e.nextState,s=e.nextHook,u=e.reason,p=e.options;if(function(e,r,t){return!(x||!t.logOnDifferentValues&&(!r.whyDidYouRender||!r.whyDidYouRender.logOnDifferentValues)&&(e.propsDifferences&&e.propsDifferences.some(function(e){return e.diffType===O.different})||e.stateDifferences&&e.stateDifferences.some(function(e){return e.diffType===O.different})||e.hookDifferences&&e.hookDifferences.some(function(e){return e.diffType===O.different})))}(u,r,p)){p.consoleGroup("%c".concat(t),"color: ".concat(p.titleColor,";"));var l="Re-rendered because";u.propsDifferences&&(P({Component:r,displayName:t,prefixMessage:l,diffObjType:"props",differences:u.propsDifferences,values:{prev:o,next:f},options:p}),l="And because"),u.stateDifferences&&P({Component:r,displayName:t,prefixMessage:l,diffObjType:"state",differences:u.stateDifferences,values:{prev:i,next:c},options:p}),u.hookDifferences&&P({Component:r,displayName:t,prefixMessage:l,diffObjType:"hook",differences:u.hookDifferences,values:{prev:a,next:s},hookName:n,options:p}),u.propsDifferences||u.stateDifferences||u.hookDifferences||p.consoleLog(d({},t,r),"Re-rendered although props and state objects are the same.","This usually means there was a call to this.forceUpdate() inside the component.","more info at ".concat(k)),p.consoleGroupEnd()}}var C=function(){};function T(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=console.group,n=console.groupEnd;return r.collapseGroups?t=console.groupCollapsed:r.onlyLogs&&(t=console.log,n=C),h({include:null,exclude:null,notifier:r.notifier||((e="hotReloadBufferMs"in r?r.hotReloadBufferMs:500)&&module&&module.hot&&module.hot.addStatusHandler&&module.hot.addStatusHandler(function(r){"idle"===r&&(x=!0,setTimeout(function(){x=!1},e))}),j),onlyLogs:!1,consoleLog:console.log,consoleGroup:t,consoleGroupEnd:n,logOnDifferentValues:!1,trackHooks:!0,titleColor:"#058",diffNameColor:"blue",diffPathColor:"red"},r)}function Y(e){return e.displayName||e.name||e.type&&Y(e.type)||e.render&&Y(e.render)||(t(e)?e:void 0)}var H="undefined"!=typeof Element,W="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103,L=function(e){return e.$$typeof===W};function I(e,r,t,n,o){return t.push({diffType:o,pathString:n,prevValue:e,nextValue:r}),o!==O.different}function $(e,r,t){try{var n=[];return function e(r,t,n){var p=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";if(r===t)return!0;if(!r||!t)return I(r,t,n,p,O.different);if(u(r)&&u(t)){var l=r.length;if(l!==t.length)return I(r,t,n,p,O.different);for(var d=!0,m=l;0!=m--;)e(r[m],t[m],n,"".concat(p,"[").concat(m,"]"))||(d=!1);return I(r,t,n,p,d?O.deepEquals:O.different)}if(c(r)&&c(t))return r.getTime()===t.getTime()?I(r,t,n,p,O.date):I(r,t,n,p,O.different);if(f(r)&&f(t))return r.toString()===t.toString()?I(r,t,n,p,O.regex):I(r,t,n,p,O.different);if(H&&r instanceof Element&&t instanceof Element)return I(r,t,n,p,O.different);if(L(r)&&L(t))return r.type!==t.type?I(r,t,n,p,O.different):I(r,t,n,p,e(r.props,t.props,n,"".concat(p,".props"))?O.reactElement:O.different);if(a(r)&&a(t))return r.name===t.name?I(r,t,n,p,O.function):I(r,t,n,p,O.different);if(s(r)&&s(t)){var h=i(r),y=h.length;if(y!==i(t).length)return I(r,t,n,p,O.different);for(var v=y;0!=v--;)if(!o(t,h[v]))return I(r,t,n,p,O.different);for(var g=!0,b=y;0!=b--;){var _=h[b];e(r[_],t[_],n,"".concat(p,".").concat(_))||(g=!1)}return I(r,t,n,p,g?O.deepEquals:O.different)}return I(r,t,n,p,O.different)}(e,r,n,t),n}catch(e){if(e.message&&e.message.match(/stack|recursion/i)||-2146828260===e.number)return console.warn("Warning: why-did-you-render couldn't handle circular references in props.",e.name,e.message),!1;throw e}}var F={};function A(e,r){var t=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).shallow;if(e===r)return!1;if(!(void 0===t||t))return $(e,r);var o=e||F,i=r||F,a=Object.keys(h({},o,{},i));return n(a,function(e,r){var t=$(o[r],i[r],r);return t&&(e=[].concat(_(e),_(t))),e},[])}function M(e,r,t,n,o,i){return{propsDifferences:A(e,n),stateDifferences:A(r,o),hookDifferences:A(t,i,{shallow:!1})}}function V(e){var r=e.Component,t=e.displayName,n=e.hookName,o=e.prevProps,i=e.prevState,a=e.prevHook,f=e.nextProps,c=e.nextState,s=e.nextHook;return{Component:r,displayName:t,hookName:n,prevProps:o,prevState:i,prevHook:a,nextProps:f,nextState:c,nextHook:s,options:e.options,reason:M(o,i,a,f,c,s)}}function U(e,r,t){return!function(e,r){return r.exclude&&r.exclude.length>0&&r.exclude.some(function(r){return r.test(e)})}(r,t)&&!(!e.whyDidYouRender&&!function(e,r){return r.include&&r.include.length>0&&r.include.some(function(r){return r.test(e)})}(r,t))}var q=2;function G(e,r,t,n){var o=function(t){function o(r,t){var n,i,a;!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,o),i=this,a=y(o).call(this,r,t),(n=!a||"object"!=typeof a&&"function"!=typeof a?g(i):a)._WDYR={renderNumber:0};var f=b(y(o.prototype),"render",g(n))||n.render;return f!==e.prototype.render&&(n.render=function(){return o.prototype.render.apply(g(n)),f()}),n}var i,a,f;return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),r&&v(e,r)}(o,e),i=o,(a=[{key:"render",value:function(){return this._WDYR.renderNumber++,"isStrictMode"in this._WDYR||(this._WDYR.isStrictMode=function(e){for(var r=e._reactInternalFiber;r;){if(r.mode&q)return!0;r=r.return}return!1}(this)),this._WDYR.isStrictMode&&this._WDYR.renderNumber%2==1||(this._WDYR.prevProps&&n.notifier(V({Component:e,displayName:r,prevProps:this._WDYR.prevProps,prevState:this._WDYR.prevState,nextProps:this.props,nextState:this.state,options:n})),this._WDYR.prevProps=this.props,this._WDYR.prevState=this.state),b(y(o.prototype),"render",this)?b(y(o.prototype),"render",this).call(this):null}}])&&l(i.prototype,a),f&&l(i,f),o}();return o.displayName=r,p(o,e),o}function B(e,t,n,o,i){var a=t.path,f=n,c=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner.current;if(!c)return f;var s=c.type.ComponentForHooksTracking||c.type,u=Y(s);if(!U(s,u,i))return f;var p=o.useRef(),l=p.current;if(p.current=f,l){var d=V({Component:s,displayName:u,hookName:e,prevHook:a?r(l,a):l,nextHook:a?r(f,a):f,options:i});d.reason.hookDifferences&&i.notifier(d)}return p.current}function z(e,r,t,n,o){return r.$$typeof===E?function(e,r,t,n){var o=e.type,i=o.$$typeof===w,a=i?o.render:o;function f(){var o=arguments[0],i=t.useRef(),f=i.current;if(i.current=o,f){var c=V({Component:e,displayName:r,prevProps:f,nextProps:o,options:n});c.reason.propsDifferences&&c.reason.propsDifferences.length>0&&n.notifier(c)}return a.apply(void 0,arguments)}f.displayName=Y(a),f.ComponentForHooksTracking=e,p(f,a);var c=t.memo(i?t.forwardRef(f):f,e.compare);return c.displayName=r,p(c,e),c}(r,t,n,o):r.$$typeof===w?function(e,r,t,n){var o=e.render,i=o.$$typeof===E,a=i?o.type:o;function f(){var o=arguments[0],i=t.useRef(),f=i.current;if(i.current=o,f){var c=V({Component:e,displayName:r,prevProps:f,nextProps:o,options:n});c.reason.propsDifferences&&c.reason.propsDifferences.length>0&&n.notifier(c)}return a.apply(void 0,arguments)}f.displayName=Y(a),f.ComponentForHooksTracking=a,p(f,a);var c=t.forwardRef(i?t.memo(f,o.compare):f);return c.displayName=r,p(c,e),c}(r,t,n,o):r.prototype&&r.prototype.isReactComponent?G(r,t,0,o):function(e,r,t,n){function o(o){var i=t.useRef(),a=i.current;if(i.current=o,a){var f=V({Component:e,displayName:r,prevProps:a,nextProps:o,options:n});f.reason.propsDifferences&&n.notifier(f)}return e(o)}return o.displayName=r,o.ComponentForHooksTracking=e,p(o,e),o}(r,t,n,o)}function J(e,r,t,n,o){if(e.has(r))return e.get(r);var i=z(0,r,t,n,o);return e.set(r,i),i}var K={useState:{path:"0"},useReducer:{path:"0"},useContext:!0,useMemo:!0};function Q(r,t){var n,o=T(t),i=r.createElement,a=r.createFactory,f=new WeakMap;if(r.createElement=function(e){for(var t=null,n=null,a=null,c=arguments.length,s=new Array(c>1?c-1:0),u=1;u<c;u++)s[u-1]=arguments[u];try{if(t=("function"==typeof e||e.$$typeof===E||e.$$typeof===w)&&U(e,Y(e),o))return n=e&&e.whyDidYouRender&&e.whyDidYouRender.customName||Y(e),a=J(f,e,n,r,o),i.apply(r,[a].concat(s))}catch(r){o.consoleLog("whyDidYouRender error. Please file a bug at https://github.com/welldone-software/why-did-you-render/issues.",{errorInfo:{error:r,componentNameOrComponent:e,rest:s,options:o,isShouldTrack:t,displayName:n,WDYRPatchedComponent:a}})}return i.apply(r,[e].concat(s))},Object.assign(r.createElement,i),r.createFactory=function(e){var t=r.createElement.bind(null,e);return t.type=e,t},Object.assign(r.createFactory,a),o.trackHooks){var c=e(K,function(e,t){return function(){var i=n[t];if(!i)throw new Error("[WhyDidYouRender] A problem with React Hooks patching occurred.");var a=i.apply(void 0,arguments);return e&&B(t,!0===e?{}:e,a,r,o),a}});Object.defineProperty(r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher,"current",{set:function(e){n=e&&h({},e,{},e.origHooks)},get:function(){return n&&h({},n,{},c,{origHooks:n})}})}return r.__REVERT_WHY_DID_YOU_RENDER__=function(){Object.assign(r,{createElement:i,createFactory:a}),f=null,Object.defineProperty(r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher,"current",{writable:!0,value:n}),delete r.__REVERT_WHY_DID_YOU_RENDER__},r}Q.defaultNotifier=j;export default Q; | ||
import e from"lodash/mapValues";import r from"lodash/get";import t from"lodash/isString";import n from"lodash/reduce";import o from"lodash/has";import i from"lodash/keys";import a from"lodash/isFunction";import f from"lodash/isRegExp";import c from"lodash/isDate";import s from"lodash/isPlainObject";import u from"lodash/isArray";import p from"lodash/defaults";function l(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function d(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function m(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function h(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?m(t,!0).forEach(function(r){d(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):m(t).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e,r){return(v=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e})(e,r)}function g(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function b(e,r,t){return(b="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,r,t){var n=function(e,r){for(;!Object.prototype.hasOwnProperty.call(e,r)&&null!==(e=y(e)););return e}(e,r);if(n){var o=Object.getOwnPropertyDescriptor(n,r);return o.get?o.get.call(t):o.value}})(e,r,t||e)}function _(e){return function(e){if(Array.isArray(e)){for(var r=0,t=new Array(e.length);r<e.length;r++)t[r]=e[r];return t}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var D,O={different:"different",deepEquals:"deepEquals",date:"date",regex:"regex",reactElement:"reactElement",function:"function"},R="function"==typeof Symbol&&Symbol.for,E=R?Symbol.for("react.memo"):60115,w=R?Symbol.for("react.forward_ref"):60112,k="http://bit.ly/wdyr02",N="http://bit.ly/wdyr3",S=(d(D={},O.different,"different objects."),d(D,O.deepEquals,"different objects that are equal by value."),d(D,O.date,"different date objects with the same value."),d(D,O.regex,"different regular expressions with the same value."),d(D,O.reactElement,"different React elements with the same displayName."),d(D,O.function,"different functions with the same name."),D),x=!1;function P(e){var r=e.Component,t=e.displayName,n=e.hookName,o=e.prefixMessage,i=e.diffObjType,a=e.differences,f=e.values,c=e.options;a&&a.length>0?(c.consoleLog(d({},t,r),"".concat(o," of ").concat(i," changes:")),a.forEach(function(e){var r=e.pathString,t=e.diffType,o=e.prevValue,a=e.nextValue;c.consoleGroup("%c".concat("hook"===i?"[hook ".concat(n," result]"):"".concat(i,"."),"%c").concat(r,"%c"),"color:".concat(c.diffNameColor,";"),"color:".concat(c.diffPathColor,";"),"color:default;"),c.consoleLog("".concat(S[t]," (more info at ").concat(n?N:k,")")),c.consoleLog(d({},"prev ".concat(r),o),"!==",d({},"next ".concat(r),a)),c.consoleGroupEnd()})):a&&(c.consoleLog(d({},t,r),"".concat(o," the ").concat(i," object itself changed but its values are all equal."),"props"===i?"This could have been avoided by making the component pure, or by preventing its father from re-rendering.":"This usually means this component called setState when no changes in its state actually occurred.","More info at ".concat(k)),c.consoleLog("prev ".concat(i,":"),f.prev," !== ",f.next,":next ".concat(i)))}function j(e){var r=e.Component,t=e.displayName,n=e.hookName,o=e.prevProps,i=e.prevState,a=e.prevHook,f=e.nextProps,c=e.nextState,s=e.nextHook,u=e.reason,p=e.options;if(function(e,r,t){return!(x||!t.logOnDifferentValues&&(!r.whyDidYouRender||!r.whyDidYouRender.logOnDifferentValues)&&(e.propsDifferences&&e.propsDifferences.some(function(e){return e.diffType===O.different})||e.stateDifferences&&e.stateDifferences.some(function(e){return e.diffType===O.different})||e.hookDifferences&&e.hookDifferences.some(function(e){return e.diffType===O.different})))}(u,r,p)){p.consoleGroup("%c".concat(t),"color: ".concat(p.titleColor,";"));var l="Re-rendered because";u.propsDifferences&&(P({Component:r,displayName:t,prefixMessage:l,diffObjType:"props",differences:u.propsDifferences,values:{prev:o,next:f},options:p}),l="And because"),u.stateDifferences&&P({Component:r,displayName:t,prefixMessage:l,diffObjType:"state",differences:u.stateDifferences,values:{prev:i,next:c},options:p}),u.hookDifferences&&P({Component:r,displayName:t,prefixMessage:l,diffObjType:"hook",differences:u.hookDifferences,values:{prev:a,next:s},hookName:n,options:p}),u.propsDifferences||u.stateDifferences||u.hookDifferences||p.consoleLog(d({},t,r),"Re-rendered although props and state objects are the same.","This usually means there was a call to this.forceUpdate() inside the component.","more info at ".concat(k)),p.consoleGroupEnd()}}var C=function(){};function T(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=console.group,n=console.groupEnd;return r.collapseGroups?t=console.groupCollapsed:r.onlyLogs&&(t=console.log,n=C),h({include:null,exclude:null,notifier:r.notifier||((e="hotReloadBufferMs"in r?r.hotReloadBufferMs:500)&&module&&module.hot&&module.hot.addStatusHandler&&module.hot.addStatusHandler(function(r){"idle"===r&&(x=!0,setTimeout(function(){x=!1},e))}),j),onlyLogs:!1,consoleLog:console.log,consoleGroup:t,consoleGroupEnd:n,logOnDifferentValues:!1,trackHooks:!0,titleColor:"#058",diffNameColor:"blue",diffPathColor:"red"},r)}function Y(e){return e.displayName||e.name||e.type&&Y(e.type)||e.render&&Y(e.render)||(t(e)?e:void 0)}var H="undefined"!=typeof Element,W="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103,L=function(e){return e.$$typeof===W};function I(e,r,t,n,o){return t.push({diffType:o,pathString:n,prevValue:e,nextValue:r}),o!==O.different}function $(e,r,t){try{var n=[];return function e(r,t,n){var p=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";if(r===t)return!0;if(!r||!t)return I(r,t,n,p,O.different);if(u(r)&&u(t)){var l=r.length;if(l!==t.length)return I(r,t,n,p,O.different);for(var d=!0,m=l;0!=m--;)e(r[m],t[m],n,"".concat(p,"[").concat(m,"]"))||(d=!1);return I(r,t,n,p,d?O.deepEquals:O.different)}if(c(r)&&c(t))return r.getTime()===t.getTime()?I(r,t,n,p,O.date):I(r,t,n,p,O.different);if(f(r)&&f(t))return r.toString()===t.toString()?I(r,t,n,p,O.regex):I(r,t,n,p,O.different);if(H&&r instanceof Element&&t instanceof Element)return I(r,t,n,p,O.different);if(L(r)&&L(t))return r.type!==t.type?I(r,t,n,p,O.different):I(r,t,n,p,e(r.props,t.props,n,"".concat(p,".props"))?O.reactElement:O.different);if(a(r)&&a(t))return r.name===t.name?I(r,t,n,p,O.function):I(r,t,n,p,O.different);if(s(r)&&s(t)){var h=i(r),y=h.length;if(y!==i(t).length)return I(r,t,n,p,O.different);for(var v=y;0!=v--;)if(!o(t,h[v]))return I(r,t,n,p,O.different);for(var g=!0,b=y;0!=b--;){var _=h[b];e(r[_],t[_],n,"".concat(p,".").concat(_))||(g=!1)}return I(r,t,n,p,g?O.deepEquals:O.different)}return I(r,t,n,p,O.different)}(e,r,n,t),n}catch(e){if(e.message&&e.message.match(/stack|recursion/i)||-2146828260===e.number)return console.warn("Warning: why-did-you-render couldn't handle circular references in props.",e.name,e.message),!1;throw e}}var F={};function A(e,r){var t=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).shallow;if(e===r)return!1;if(!(void 0===t||t))return $(e,r);var o=e||F,i=r||F,a=Object.keys(h({},o,{},i));return n(a,function(e,r){var t=$(o[r],i[r],r);return t&&(e=[].concat(_(e),_(t))),e},[])}function M(e,r,t,n,o,i){return{propsDifferences:A(e,n),stateDifferences:A(r,o),hookDifferences:A(t,i,{shallow:!1})}}function V(e){var r=e.Component,t=e.displayName,n=e.hookName,o=e.prevProps,i=e.prevState,a=e.prevHook,f=e.nextProps,c=e.nextState,s=e.nextHook;return{Component:r,displayName:t,hookName:n,prevProps:o,prevState:i,prevHook:a,nextProps:f,nextState:c,nextHook:s,options:e.options,reason:M(o,i,a,f,c,s)}}function U(e,r,t){return!function(e,r){return r.exclude&&r.exclude.length>0&&r.exclude.some(function(r){return r.test(e)})}(r,t)&&!(!e.whyDidYouRender&&!function(e,r){return r.include&&r.include.length>0&&r.include.some(function(r){return r.test(e)})}(r,t))}var q=1;function G(e,r,t,n){var o=function(t){function o(r,t){var n,i,a;!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,o),i=this,a=y(o).call(this,r,t),(n=!a||"object"!=typeof a&&"function"!=typeof a?g(i):a)._WDYR={renderNumber:0};var f=b(y(o.prototype),"render",g(n))||n.render;return f!==e.prototype.render&&(n.render=function(){return o.prototype.render.apply(g(n)),f()}),n}var i,a,f;return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),r&&v(e,r)}(o,e),i=o,(a=[{key:"render",value:function(){return this._WDYR.renderNumber++,"isStrictMode"in this._WDYR||(this._WDYR.isStrictMode=function(e){for(var r=e._reactInternalFiber;null!==r;){if(r.mode&q)return!0;r=r.return}return!1}(this)),this._WDYR.isStrictMode&&this._WDYR.renderNumber%2==1||(this._WDYR.prevProps&&n.notifier(V({Component:e,displayName:r,prevProps:this._WDYR.prevProps,prevState:this._WDYR.prevState,nextProps:this.props,nextState:this.state,options:n})),this._WDYR.prevProps=this.props,this._WDYR.prevState=this.state),b(y(o.prototype),"render",this)?b(y(o.prototype),"render",this).call(this):null}}])&&l(i.prototype,a),f&&l(i,f),o}();return o.displayName=r,p(o,e),o}function B(e,t,n,o,i){var a=t.path,f=n,c=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner.current;if(!c)return f;var s=c.type.ComponentForHooksTracking||c.type,u=Y(s);if(!U(s,u,i))return f;var p=o.useRef(),l=p.current;if(p.current=f,l){var d=V({Component:s,displayName:u,hookName:e,prevHook:a?r(l,a):l,nextHook:a?r(f,a):f,options:i});d.reason.hookDifferences&&i.notifier(d)}return p.current}function z(e,r,t,n,o){return r.$$typeof===E?function(e,r,t,n){var o=e.type,i=o.$$typeof===w,a=i?o.render:o;function f(){var o=arguments[0],i=t.useRef(),f=i.current;if(i.current=o,f){var c=V({Component:e,displayName:r,prevProps:f,nextProps:o,options:n});c.reason.propsDifferences&&c.reason.propsDifferences.length>0&&n.notifier(c)}return a.apply(void 0,arguments)}f.displayName=Y(a),f.ComponentForHooksTracking=e,p(f,a);var c=t.memo(i?t.forwardRef(f):f,e.compare);return c.displayName=r,p(c,e),c}(r,t,n,o):r.$$typeof===w?function(e,r,t,n){var o=e.render,i=o.$$typeof===E,a=i?o.type:o;function f(){var o=arguments[0],i=t.useRef(),f=i.current;if(i.current=o,f){var c=V({Component:e,displayName:r,prevProps:f,nextProps:o,options:n});c.reason.propsDifferences&&c.reason.propsDifferences.length>0&&n.notifier(c)}return a.apply(void 0,arguments)}f.displayName=Y(a),f.ComponentForHooksTracking=a,p(f,a);var c=t.forwardRef(i?t.memo(f,o.compare):f);return c.displayName=r,p(c,e),c}(r,t,n,o):r.prototype&&r.prototype.isReactComponent?G(r,t,0,o):function(e,r,t,n){function o(o){var i=t.useRef(),a=i.current;if(i.current=o,a){var f=V({Component:e,displayName:r,prevProps:a,nextProps:o,options:n});f.reason.propsDifferences&&n.notifier(f)}return e(o)}return o.displayName=r,o.ComponentForHooksTracking=e,p(o,e),o}(r,t,n,o)}function J(e,r,t,n,o){if(e.has(r))return e.get(r);var i=z(0,r,t,n,o);return e.set(r,i),i}var K={useState:{path:"0"},useReducer:{path:"0"},useContext:!0,useMemo:!0};function Q(r,t){var n,o=T(t),i=r.createElement,a=r.createFactory,f=new WeakMap;if(r.createElement=function(e){for(var t=null,n=null,a=null,c=arguments.length,s=new Array(c>1?c-1:0),u=1;u<c;u++)s[u-1]=arguments[u];try{if(t=("function"==typeof e||e.$$typeof===E||e.$$typeof===w)&&U(e,Y(e),o))return n=e&&e.whyDidYouRender&&e.whyDidYouRender.customName||Y(e),a=J(f,e,n,r,o),i.apply(r,[a].concat(s))}catch(r){o.consoleLog("whyDidYouRender error. Please file a bug at https://github.com/welldone-software/why-did-you-render/issues.",{errorInfo:{error:r,componentNameOrComponent:e,rest:s,options:o,isShouldTrack:t,displayName:n,WDYRPatchedComponent:a}})}return i.apply(r,[e].concat(s))},Object.assign(r.createElement,i),r.createFactory=function(e){var t=r.createElement.bind(null,e);return t.type=e,t},Object.assign(r.createFactory,a),o.trackHooks){var c=e(K,function(e,t){return function(){var i=n[t];if(!i)throw new Error("[WhyDidYouRender] A problem with React Hooks patching occurred.");var a=i.apply(void 0,arguments);return e&&B(t,!0===e?{}:e,a,r,o),a}});Object.defineProperty(r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher,"current",{set:function(e){n=e&&h({},e,{},e.origHooks)},get:function(){return n&&h({},n,{},c,{origHooks:n})}})}return r.__REVERT_WHY_DID_YOU_RENDER__=function(){Object.assign(r,{createElement:i,createFactory:a}),f=null,Object.defineProperty(r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher,"current",{writable:!0,value:n}),delete r.__REVERT_WHY_DID_YOU_RENDER__},r}Q.defaultNotifier=j;export default Q; | ||
//# sourceMappingURL=whyDidYouRender.min.js.map |
/** | ||
* @welldone-software/why-did-you-render 3.3.2 | ||
* @welldone-software/why-did-you-render 3.3.3 | ||
* MIT Licensed | ||
* Generated by Vitali Zaidman <vzaidman@gmail.com> (https://github.com/vzaidman) | ||
* Generated at 2019-08-09 | ||
* Generated at 2019-08-13 | ||
*/ | ||
@@ -500,3 +500,3 @@ | ||
// copied from https://github.com/facebook/react/blob/master/packages/react-reconciler/src/ReactTypeOfMode.js | ||
var StrictMode = 2; // based on "findStrictRoot" from https://github.com/facebook/react/blob/master/packages/react-reconciler/src/ReactStrictModeWarnings.js | ||
var StrictMode = 1; // based on "findStrictRoot" from https://github.com/facebook/react/blob/master/packages/react-reconciler/src/ReactStrictModeWarnings.js | ||
// notice: this is only used for class components. functional components doesn't re-rendered inside strict mode | ||
@@ -507,3 +507,3 @@ | ||
while (reactInternalFiber) { | ||
while (reactInternalFiber !== null) { | ||
if (reactInternalFiber.mode & StrictMode) { | ||
@@ -510,0 +510,0 @@ return true; |
/** | ||
* @welldone-software/why-did-you-render 3.3.2 | ||
* @welldone-software/why-did-you-render 3.3.3 | ||
* MIT Licensed | ||
* Generated by Vitali Zaidman <vzaidman@gmail.com> (https://github.com/vzaidman) | ||
* Generated at 2019-08-09 | ||
* Generated at 2019-08-13 | ||
*/ | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var _mapValues=_interopDefault(require("lodash/mapValues")),_get=_interopDefault(require("lodash/get")),_isString=_interopDefault(require("lodash/isString")),_reduce=_interopDefault(require("lodash/reduce")),_has=_interopDefault(require("lodash/has")),_keys=_interopDefault(require("lodash/keys")),_isFunction=_interopDefault(require("lodash/isFunction")),_isRegExp=_interopDefault(require("lodash/isRegExp")),_isDate=_interopDefault(require("lodash/isDate")),_isPlainObject=_interopDefault(require("lodash/isPlainObject")),_isArray=_interopDefault(require("lodash/isArray")),_defaults=_interopDefault(require("lodash/defaults"));function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,o)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(r,!0).forEach(function(t){_defineProperty(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}function _iterableToArray(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance")}var _diffTypesDescription,diffTypes={different:"different",deepEquals:"deepEquals",date:"date",regex:"regex",reactElement:"reactElement",function:"function"},hasSymbol="function"==typeof Symbol&&Symbol.for,REACT_MEMO_TYPE=hasSymbol?Symbol.for("react.memo"):60115,REACT_FORWARD_REF_TYPE=hasSymbol?Symbol.for("react.forward_ref"):60112,moreInfoUrl="http://bit.ly/wdyr02",moreInfoHooksUrl="http://bit.ly/wdyr3",diffTypesDescriptions=(_defineProperty(_diffTypesDescription={},diffTypes.different,"different objects."),_defineProperty(_diffTypesDescription,diffTypes.deepEquals,"different objects that are equal by value."),_defineProperty(_diffTypesDescription,diffTypes.date,"different date objects with the same value."),_defineProperty(_diffTypesDescription,diffTypes.regex,"different regular expressions with the same value."),_defineProperty(_diffTypesDescription,diffTypes.reactElement,"different React elements with the same displayName."),_defineProperty(_diffTypesDescription,diffTypes.function,"different functions with the same name."),_diffTypesDescription),inHotReload=!1;function shouldLog(e,t,r){return!inHotReload&&(!!r.logOnDifferentValues||(!(!t.whyDidYouRender||!t.whyDidYouRender.logOnDifferentValues)||!(e.propsDifferences&&e.propsDifferences.some(function(e){return e.diffType===diffTypes.different})||e.stateDifferences&&e.stateDifferences.some(function(e){return e.diffType===diffTypes.different})||e.hookDifferences&&e.hookDifferences.some(function(e){return e.diffType===diffTypes.different}))))}function logDifference(e){var t=e.Component,r=e.displayName,o=e.hookName,n=e.prefixMessage,i=e.diffObjType,a=e.differences,f=e.values,s=e.options;a&&a.length>0?(s.consoleLog(_defineProperty({},r,t),"".concat(n," of ").concat(i," changes:")),a.forEach(function(e){var t=e.pathString,r=e.diffType,n=e.prevValue,a=e.nextValue;s.consoleGroup("%c".concat("hook"===i?"[hook ".concat(o," result]"):"".concat(i,"."),"%c").concat(t,"%c"),"color:".concat(s.diffNameColor,";"),"color:".concat(s.diffPathColor,";"),"color:default;"),s.consoleLog("".concat(diffTypesDescriptions[r]," (more info at ").concat(o?moreInfoHooksUrl:moreInfoUrl,")")),s.consoleLog(_defineProperty({},"prev ".concat(t),n),"!==",_defineProperty({},"next ".concat(t),a)),s.consoleGroupEnd()})):a&&(s.consoleLog(_defineProperty({},r,t),"".concat(n," the ").concat(i," object itself changed but its values are all equal."),"props"===i?"This could have been avoided by making the component pure, or by preventing its father from re-rendering.":"This usually means this component called setState when no changes in its state actually occurred.","More info at ".concat(moreInfoUrl)),s.consoleLog("prev ".concat(i,":"),f.prev," !== ",f.next,":next ".concat(i)))}function defaultNotifier(e){var t=e.Component,r=e.displayName,o=e.hookName,n=e.prevProps,i=e.prevState,a=e.prevHook,f=e.nextProps,s=e.nextState,c=e.nextHook,p=e.reason,u=e.options;if(shouldLog(p,t,u)){u.consoleGroup("%c".concat(r),"color: ".concat(u.titleColor,";"));var l="Re-rendered because";p.propsDifferences&&(logDifference({Component:t,displayName:r,prefixMessage:l,diffObjType:"props",differences:p.propsDifferences,values:{prev:n,next:f},options:u}),l="And because"),p.stateDifferences&&logDifference({Component:t,displayName:r,prefixMessage:l,diffObjType:"state",differences:p.stateDifferences,values:{prev:i,next:s},options:u}),p.hookDifferences&&logDifference({Component:t,displayName:r,prefixMessage:l,diffObjType:"hook",differences:p.hookDifferences,values:{prev:a,next:c},hookName:o,options:u}),p.propsDifferences||p.stateDifferences||p.hookDifferences||u.consoleLog(_defineProperty({},r,t),"Re-rendered although props and state objects are the same.","This usually means there was a call to this.forceUpdate() inside the component.","more info at ".concat(moreInfoUrl)),u.consoleGroupEnd()}}function createDefaultNotifier(e){return e&&module&&module.hot&&module.hot.addStatusHandler&&module.hot.addStatusHandler(function(t){"idle"===t&&(inHotReload=!0,setTimeout(function(){inHotReload=!1},e))}),defaultNotifier}var emptyFn=function(){};function normalizeOptions(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=console.group,r=console.groupEnd;return e.collapseGroups?t=console.groupCollapsed:e.onlyLogs&&(t=console.log,r=emptyFn),_objectSpread2({include:null,exclude:null,notifier:e.notifier||createDefaultNotifier("hotReloadBufferMs"in e?e.hotReloadBufferMs:500),onlyLogs:!1,consoleLog:console.log,consoleGroup:t,consoleGroupEnd:r,logOnDifferentValues:!1,trackHooks:!0,titleColor:"#058",diffNameColor:"blue",diffPathColor:"red"},e)}function getDisplayName(e){return e.displayName||e.name||e.type&&getDisplayName(e.type)||e.render&&getDisplayName(e.render)||(_isString(e)?e:void 0)}var hasElementType="undefined"!=typeof Element,hasSymbol$1="function"==typeof Symbol&&Symbol.for,REACT_ELEMENT_TYPE=hasSymbol$1?Symbol.for("react.element"):60103,isReactElement=function(e){return e.$$typeof===REACT_ELEMENT_TYPE};function trackDiff(e,t,r,o,n){return r.push({diffType:n,pathString:o,prevValue:e,nextValue:t}),n!==diffTypes.different}function accumulateDeepEqualDiffs(e,t,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";if(e===t)return!0;if(!e||!t)return trackDiff(e,t,r,o,diffTypes.different);if(_isArray(e)&&_isArray(t)){var n=e.length;if(n!==t.length)return trackDiff(e,t,r,o,diffTypes.different);for(var i=!0,a=n;0!=a--;)accumulateDeepEqualDiffs(e[a],t[a],r,"".concat(o,"[").concat(a,"]"))||(i=!1);return trackDiff(e,t,r,o,i?diffTypes.deepEquals:diffTypes.different)}if(_isDate(e)&&_isDate(t))return e.getTime()===t.getTime()?trackDiff(e,t,r,o,diffTypes.date):trackDiff(e,t,r,o,diffTypes.different);if(_isRegExp(e)&&_isRegExp(t))return e.toString()===t.toString()?trackDiff(e,t,r,o,diffTypes.regex):trackDiff(e,t,r,o,diffTypes.different);if(hasElementType&&e instanceof Element&&t instanceof Element)return trackDiff(e,t,r,o,diffTypes.different);if(isReactElement(e)&&isReactElement(t))return e.type!==t.type?trackDiff(e,t,r,o,diffTypes.different):trackDiff(e,t,r,o,accumulateDeepEqualDiffs(e.props,t.props,r,"".concat(o,".props"))?diffTypes.reactElement:diffTypes.different);if(_isFunction(e)&&_isFunction(t))return e.name===t.name?trackDiff(e,t,r,o,diffTypes.function):trackDiff(e,t,r,o,diffTypes.different);if(_isPlainObject(e)&&_isPlainObject(t)){var f=_keys(e),s=f.length;if(s!==_keys(t).length)return trackDiff(e,t,r,o,diffTypes.different);for(var c=s;0!=c--;)if(!_has(t,f[c]))return trackDiff(e,t,r,o,diffTypes.different);for(var p=!0,u=s;0!=u--;){var l=f[u];accumulateDeepEqualDiffs(e[l],t[l],r,"".concat(o,".").concat(l))||(p=!1)}return trackDiff(e,t,r,o,p?diffTypes.deepEquals:diffTypes.different)}return trackDiff(e,t,r,o,diffTypes.different)}function calculateDeepEqualDiffs(e,t,r){try{var o=[];return accumulateDeepEqualDiffs(e,t,o,r),o}catch(e){if(e.message&&e.message.match(/stack|recursion/i)||-2146828260===e.number)return console.warn("Warning: why-did-you-render couldn't handle circular references in props.",e.name,e.message),!1;throw e}}var emptyObject={};function findObjectsDifferences(e,t){var r=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).shallow;if(e===t)return!1;if(!(void 0===r||r))return calculateDeepEqualDiffs(e,t);var o=e||emptyObject,n=t||emptyObject,i=Object.keys(_objectSpread2({},o,{},n));return _reduce(i,function(e,t){var r=calculateDeepEqualDiffs(o[t],n[t],t);return r&&(e=[].concat(_toConsumableArray(e),_toConsumableArray(r))),e},[])}function getUpdateReason(e,t,r,o,n,i){return{propsDifferences:findObjectsDifferences(e,o),stateDifferences:findObjectsDifferences(t,n),hookDifferences:findObjectsDifferences(r,i,{shallow:!1})}}function getUpdateInfo(e){var t=e.Component,r=e.displayName,o=e.hookName,n=e.prevProps,i=e.prevState,a=e.prevHook,f=e.nextProps,s=e.nextState,c=e.nextHook;return{Component:t,displayName:r,hookName:o,prevProps:n,prevState:i,prevHook:a,nextProps:f,nextState:s,nextHook:c,options:e.options,reason:getUpdateReason(n,i,a,f,s,c)}}function shouldInclude(e,t){return t.include&&t.include.length>0&&t.include.some(function(t){return t.test(e)})}function shouldExclude(e,t){return t.exclude&&t.exclude.length>0&&t.exclude.some(function(t){return t.test(e)})}function shouldTrack(e,t,r){return!shouldExclude(t,r)&&!(!e.whyDidYouRender&&!shouldInclude(t,r))}var StrictMode=2;function checkIfInsideAStrictModeTree(e){for(var t=e._reactInternalFiber;t;){if(t.mode&StrictMode)return!0;t=t.return}return!1}function patchClassComponent(e,t,r,o){class n extends e{constructor(t,r){var o;super(t,r),o=this,this._WDYR={renderNumber:0};var i=super.render||this.render;i!==e.prototype.render&&(this.render=function(){return n.prototype.render.apply(o),i()})}render(){return this._WDYR.renderNumber++,"isStrictMode"in this._WDYR||(this._WDYR.isStrictMode=checkIfInsideAStrictModeTree(this)),this._WDYR.isStrictMode&&this._WDYR.renderNumber%2==1||(this._WDYR.prevProps&&o.notifier(getUpdateInfo({Component:e,displayName:t,prevProps:this._WDYR.prevProps,prevState:this._WDYR.prevState,nextProps:this.props,nextState:this.state,options:o})),this._WDYR.prevProps=this.props,this._WDYR.prevState=this.state),super.render?super.render():null}}return n.displayName=t,_defaults(n,e),n}function patchFunctionalComponent(e,t,r,o){function n(n){var i=r.useRef(),a=i.current;if(i.current=n,a){var f=getUpdateInfo({Component:e,displayName:t,prevProps:a,nextProps:n,options:o});f.reason.propsDifferences&&o.notifier(f)}return e(n)}return n.displayName=t,n.ComponentForHooksTracking=e,_defaults(n,e),n}function patchMemoComponent(e,t,r,o){var n=e.type,i=n.$$typeof===REACT_FORWARD_REF_TYPE,a=i?n.render:n;function f(){var n=arguments[0],i=r.useRef(),f=i.current;if(i.current=n,f){var s=getUpdateInfo({Component:e,displayName:t,prevProps:f,nextProps:n,options:o});s.reason.propsDifferences&&s.reason.propsDifferences.length>0&&o.notifier(s)}return a.apply(void 0,arguments)}f.displayName=getDisplayName(a),f.ComponentForHooksTracking=e,_defaults(f,a);var s=r.memo(i?r.forwardRef(f):f,e.compare);return s.displayName=t,_defaults(s,e),s}function patchForwardRefComponent(e,t,r,o){var n=e.render,i=n.$$typeof===REACT_MEMO_TYPE,a=i?n.type:n;function f(){var n=arguments[0],i=r.useRef(),f=i.current;if(i.current=n,f){var s=getUpdateInfo({Component:e,displayName:t,prevProps:f,nextProps:n,options:o});s.reason.propsDifferences&&s.reason.propsDifferences.length>0&&o.notifier(s)}return a.apply(void 0,arguments)}f.displayName=getDisplayName(a),f.ComponentForHooksTracking=a,_defaults(f,a);var s=r.forwardRef(i?r.memo(f,n.compare):f);return s.displayName=t,_defaults(s,e),s}function trackHookChanges(e,t,r,o,n){var i=t.path,a=r,f=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner.current;if(!f)return a;var s=f.type.ComponentForHooksTracking||f.type,c=getDisplayName(s);if(!shouldTrack(s,c,n))return a;var p=o.useRef(),u=p.current;if(p.current=a,u){var l=getUpdateInfo({Component:s,displayName:c,hookName:e,prevHook:i?_get(u,i):u,nextHook:i?_get(a,i):a,options:n});l.reason.hookDifferences&&n.notifier(l)}return p.current}function createPatchedComponent(e,t,r,o,n){return t.$$typeof===REACT_MEMO_TYPE?patchMemoComponent(t,r,o,n):t.$$typeof===REACT_FORWARD_REF_TYPE?patchForwardRefComponent(t,r,o,n):t.prototype&&t.prototype.isReactComponent?patchClassComponent(t,r,o,n):patchFunctionalComponent(t,r,o,n)}function getPatchedComponent(e,t,r,o,n){if(e.has(t))return e.get(t);var i=createPatchedComponent(e,t,r,o,n);return e.set(t,i),i}var hooksConfig={useState:{path:"0"},useReducer:{path:"0"},useContext:!0,useMemo:!0};function whyDidYouRender(e,t){var r,o=normalizeOptions(t),n=e.createElement,i=e.createFactory,a=new WeakMap;if(e.createElement=function(t){for(var r=null,i=null,f=null,s=arguments.length,c=new Array(s>1?s-1:0),p=1;p<s;p++)c[p-1]=arguments[p];try{if(r=("function"==typeof t||t.$$typeof===REACT_MEMO_TYPE||t.$$typeof===REACT_FORWARD_REF_TYPE)&&shouldTrack(t,getDisplayName(t),o))return i=t&&t.whyDidYouRender&&t.whyDidYouRender.customName||getDisplayName(t),f=getPatchedComponent(a,t,i,e,o),n.apply(e,[f].concat(c))}catch(e){o.consoleLog("whyDidYouRender error. Please file a bug at https://github.com/welldone-software/why-did-you-render/issues.",{errorInfo:{error:e,componentNameOrComponent:t,rest:c,options:o,isShouldTrack:r,displayName:i,WDYRPatchedComponent:f}})}return n.apply(e,[t].concat(c))},Object.assign(e.createElement,n),e.createFactory=function(t){var r=e.createElement.bind(null,t);return r.type=t,r},Object.assign(e.createFactory,i),o.trackHooks){var f=_mapValues(hooksConfig,function(t,n){return function(){var i=r[n];if(!i)throw new Error("[WhyDidYouRender] A problem with React Hooks patching occurred.");var a=i.apply(void 0,arguments);return t&&trackHookChanges(n,!0===t?{}:t,a,e,o),a}});Object.defineProperty(e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher,"current",{set:function(e){r=e&&_objectSpread2({},e,{},e.origHooks)},get:function(){return r&&_objectSpread2({},r,{},f,{origHooks:r})}})}return e.__REVERT_WHY_DID_YOU_RENDER__=function(){Object.assign(e,{createElement:n,createFactory:i}),a=null,Object.defineProperty(e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher,"current",{writable:!0,value:r}),delete e.__REVERT_WHY_DID_YOU_RENDER__},e}whyDidYouRender.defaultNotifier=defaultNotifier,module.exports=whyDidYouRender; | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var _mapValues=_interopDefault(require("lodash/mapValues")),_get=_interopDefault(require("lodash/get")),_isString=_interopDefault(require("lodash/isString")),_reduce=_interopDefault(require("lodash/reduce")),_has=_interopDefault(require("lodash/has")),_keys=_interopDefault(require("lodash/keys")),_isFunction=_interopDefault(require("lodash/isFunction")),_isRegExp=_interopDefault(require("lodash/isRegExp")),_isDate=_interopDefault(require("lodash/isDate")),_isPlainObject=_interopDefault(require("lodash/isPlainObject")),_isArray=_interopDefault(require("lodash/isArray")),_defaults=_interopDefault(require("lodash/defaults"));function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,o)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(r,!0).forEach(function(t){_defineProperty(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}function _iterableToArray(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance")}var _diffTypesDescription,diffTypes={different:"different",deepEquals:"deepEquals",date:"date",regex:"regex",reactElement:"reactElement",function:"function"},hasSymbol="function"==typeof Symbol&&Symbol.for,REACT_MEMO_TYPE=hasSymbol?Symbol.for("react.memo"):60115,REACT_FORWARD_REF_TYPE=hasSymbol?Symbol.for("react.forward_ref"):60112,moreInfoUrl="http://bit.ly/wdyr02",moreInfoHooksUrl="http://bit.ly/wdyr3",diffTypesDescriptions=(_defineProperty(_diffTypesDescription={},diffTypes.different,"different objects."),_defineProperty(_diffTypesDescription,diffTypes.deepEquals,"different objects that are equal by value."),_defineProperty(_diffTypesDescription,diffTypes.date,"different date objects with the same value."),_defineProperty(_diffTypesDescription,diffTypes.regex,"different regular expressions with the same value."),_defineProperty(_diffTypesDescription,diffTypes.reactElement,"different React elements with the same displayName."),_defineProperty(_diffTypesDescription,diffTypes.function,"different functions with the same name."),_diffTypesDescription),inHotReload=!1;function shouldLog(e,t,r){return!inHotReload&&(!!r.logOnDifferentValues||(!(!t.whyDidYouRender||!t.whyDidYouRender.logOnDifferentValues)||!(e.propsDifferences&&e.propsDifferences.some(function(e){return e.diffType===diffTypes.different})||e.stateDifferences&&e.stateDifferences.some(function(e){return e.diffType===diffTypes.different})||e.hookDifferences&&e.hookDifferences.some(function(e){return e.diffType===diffTypes.different}))))}function logDifference(e){var t=e.Component,r=e.displayName,o=e.hookName,n=e.prefixMessage,i=e.diffObjType,a=e.differences,f=e.values,s=e.options;a&&a.length>0?(s.consoleLog(_defineProperty({},r,t),"".concat(n," of ").concat(i," changes:")),a.forEach(function(e){var t=e.pathString,r=e.diffType,n=e.prevValue,a=e.nextValue;s.consoleGroup("%c".concat("hook"===i?"[hook ".concat(o," result]"):"".concat(i,"."),"%c").concat(t,"%c"),"color:".concat(s.diffNameColor,";"),"color:".concat(s.diffPathColor,";"),"color:default;"),s.consoleLog("".concat(diffTypesDescriptions[r]," (more info at ").concat(o?moreInfoHooksUrl:moreInfoUrl,")")),s.consoleLog(_defineProperty({},"prev ".concat(t),n),"!==",_defineProperty({},"next ".concat(t),a)),s.consoleGroupEnd()})):a&&(s.consoleLog(_defineProperty({},r,t),"".concat(n," the ").concat(i," object itself changed but its values are all equal."),"props"===i?"This could have been avoided by making the component pure, or by preventing its father from re-rendering.":"This usually means this component called setState when no changes in its state actually occurred.","More info at ".concat(moreInfoUrl)),s.consoleLog("prev ".concat(i,":"),f.prev," !== ",f.next,":next ".concat(i)))}function defaultNotifier(e){var t=e.Component,r=e.displayName,o=e.hookName,n=e.prevProps,i=e.prevState,a=e.prevHook,f=e.nextProps,s=e.nextState,c=e.nextHook,p=e.reason,u=e.options;if(shouldLog(p,t,u)){u.consoleGroup("%c".concat(r),"color: ".concat(u.titleColor,";"));var l="Re-rendered because";p.propsDifferences&&(logDifference({Component:t,displayName:r,prefixMessage:l,diffObjType:"props",differences:p.propsDifferences,values:{prev:n,next:f},options:u}),l="And because"),p.stateDifferences&&logDifference({Component:t,displayName:r,prefixMessage:l,diffObjType:"state",differences:p.stateDifferences,values:{prev:i,next:s},options:u}),p.hookDifferences&&logDifference({Component:t,displayName:r,prefixMessage:l,diffObjType:"hook",differences:p.hookDifferences,values:{prev:a,next:c},hookName:o,options:u}),p.propsDifferences||p.stateDifferences||p.hookDifferences||u.consoleLog(_defineProperty({},r,t),"Re-rendered although props and state objects are the same.","This usually means there was a call to this.forceUpdate() inside the component.","more info at ".concat(moreInfoUrl)),u.consoleGroupEnd()}}function createDefaultNotifier(e){return e&&module&&module.hot&&module.hot.addStatusHandler&&module.hot.addStatusHandler(function(t){"idle"===t&&(inHotReload=!0,setTimeout(function(){inHotReload=!1},e))}),defaultNotifier}var emptyFn=function(){};function normalizeOptions(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=console.group,r=console.groupEnd;return e.collapseGroups?t=console.groupCollapsed:e.onlyLogs&&(t=console.log,r=emptyFn),_objectSpread2({include:null,exclude:null,notifier:e.notifier||createDefaultNotifier("hotReloadBufferMs"in e?e.hotReloadBufferMs:500),onlyLogs:!1,consoleLog:console.log,consoleGroup:t,consoleGroupEnd:r,logOnDifferentValues:!1,trackHooks:!0,titleColor:"#058",diffNameColor:"blue",diffPathColor:"red"},e)}function getDisplayName(e){return e.displayName||e.name||e.type&&getDisplayName(e.type)||e.render&&getDisplayName(e.render)||(_isString(e)?e:void 0)}var hasElementType="undefined"!=typeof Element,hasSymbol$1="function"==typeof Symbol&&Symbol.for,REACT_ELEMENT_TYPE=hasSymbol$1?Symbol.for("react.element"):60103,isReactElement=function(e){return e.$$typeof===REACT_ELEMENT_TYPE};function trackDiff(e,t,r,o,n){return r.push({diffType:n,pathString:o,prevValue:e,nextValue:t}),n!==diffTypes.different}function accumulateDeepEqualDiffs(e,t,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";if(e===t)return!0;if(!e||!t)return trackDiff(e,t,r,o,diffTypes.different);if(_isArray(e)&&_isArray(t)){var n=e.length;if(n!==t.length)return trackDiff(e,t,r,o,diffTypes.different);for(var i=!0,a=n;0!=a--;)accumulateDeepEqualDiffs(e[a],t[a],r,"".concat(o,"[").concat(a,"]"))||(i=!1);return trackDiff(e,t,r,o,i?diffTypes.deepEquals:diffTypes.different)}if(_isDate(e)&&_isDate(t))return e.getTime()===t.getTime()?trackDiff(e,t,r,o,diffTypes.date):trackDiff(e,t,r,o,diffTypes.different);if(_isRegExp(e)&&_isRegExp(t))return e.toString()===t.toString()?trackDiff(e,t,r,o,diffTypes.regex):trackDiff(e,t,r,o,diffTypes.different);if(hasElementType&&e instanceof Element&&t instanceof Element)return trackDiff(e,t,r,o,diffTypes.different);if(isReactElement(e)&&isReactElement(t))return e.type!==t.type?trackDiff(e,t,r,o,diffTypes.different):trackDiff(e,t,r,o,accumulateDeepEqualDiffs(e.props,t.props,r,"".concat(o,".props"))?diffTypes.reactElement:diffTypes.different);if(_isFunction(e)&&_isFunction(t))return e.name===t.name?trackDiff(e,t,r,o,diffTypes.function):trackDiff(e,t,r,o,diffTypes.different);if(_isPlainObject(e)&&_isPlainObject(t)){var f=_keys(e),s=f.length;if(s!==_keys(t).length)return trackDiff(e,t,r,o,diffTypes.different);for(var c=s;0!=c--;)if(!_has(t,f[c]))return trackDiff(e,t,r,o,diffTypes.different);for(var p=!0,u=s;0!=u--;){var l=f[u];accumulateDeepEqualDiffs(e[l],t[l],r,"".concat(o,".").concat(l))||(p=!1)}return trackDiff(e,t,r,o,p?diffTypes.deepEquals:diffTypes.different)}return trackDiff(e,t,r,o,diffTypes.different)}function calculateDeepEqualDiffs(e,t,r){try{var o=[];return accumulateDeepEqualDiffs(e,t,o,r),o}catch(e){if(e.message&&e.message.match(/stack|recursion/i)||-2146828260===e.number)return console.warn("Warning: why-did-you-render couldn't handle circular references in props.",e.name,e.message),!1;throw e}}var emptyObject={};function findObjectsDifferences(e,t){var r=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).shallow;if(e===t)return!1;if(!(void 0===r||r))return calculateDeepEqualDiffs(e,t);var o=e||emptyObject,n=t||emptyObject,i=Object.keys(_objectSpread2({},o,{},n));return _reduce(i,function(e,t){var r=calculateDeepEqualDiffs(o[t],n[t],t);return r&&(e=[].concat(_toConsumableArray(e),_toConsumableArray(r))),e},[])}function getUpdateReason(e,t,r,o,n,i){return{propsDifferences:findObjectsDifferences(e,o),stateDifferences:findObjectsDifferences(t,n),hookDifferences:findObjectsDifferences(r,i,{shallow:!1})}}function getUpdateInfo(e){var t=e.Component,r=e.displayName,o=e.hookName,n=e.prevProps,i=e.prevState,a=e.prevHook,f=e.nextProps,s=e.nextState,c=e.nextHook;return{Component:t,displayName:r,hookName:o,prevProps:n,prevState:i,prevHook:a,nextProps:f,nextState:s,nextHook:c,options:e.options,reason:getUpdateReason(n,i,a,f,s,c)}}function shouldInclude(e,t){return t.include&&t.include.length>0&&t.include.some(function(t){return t.test(e)})}function shouldExclude(e,t){return t.exclude&&t.exclude.length>0&&t.exclude.some(function(t){return t.test(e)})}function shouldTrack(e,t,r){return!shouldExclude(t,r)&&!(!e.whyDidYouRender&&!shouldInclude(t,r))}var StrictMode=1;function checkIfInsideAStrictModeTree(e){for(var t=e._reactInternalFiber;null!==t;){if(t.mode&StrictMode)return!0;t=t.return}return!1}function patchClassComponent(e,t,r,o){class n extends e{constructor(t,r){var o;super(t,r),o=this,this._WDYR={renderNumber:0};var i=super.render||this.render;i!==e.prototype.render&&(this.render=function(){return n.prototype.render.apply(o),i()})}render(){return this._WDYR.renderNumber++,"isStrictMode"in this._WDYR||(this._WDYR.isStrictMode=checkIfInsideAStrictModeTree(this)),this._WDYR.isStrictMode&&this._WDYR.renderNumber%2==1||(this._WDYR.prevProps&&o.notifier(getUpdateInfo({Component:e,displayName:t,prevProps:this._WDYR.prevProps,prevState:this._WDYR.prevState,nextProps:this.props,nextState:this.state,options:o})),this._WDYR.prevProps=this.props,this._WDYR.prevState=this.state),super.render?super.render():null}}return n.displayName=t,_defaults(n,e),n}function patchFunctionalComponent(e,t,r,o){function n(n){var i=r.useRef(),a=i.current;if(i.current=n,a){var f=getUpdateInfo({Component:e,displayName:t,prevProps:a,nextProps:n,options:o});f.reason.propsDifferences&&o.notifier(f)}return e(n)}return n.displayName=t,n.ComponentForHooksTracking=e,_defaults(n,e),n}function patchMemoComponent(e,t,r,o){var n=e.type,i=n.$$typeof===REACT_FORWARD_REF_TYPE,a=i?n.render:n;function f(){var n=arguments[0],i=r.useRef(),f=i.current;if(i.current=n,f){var s=getUpdateInfo({Component:e,displayName:t,prevProps:f,nextProps:n,options:o});s.reason.propsDifferences&&s.reason.propsDifferences.length>0&&o.notifier(s)}return a.apply(void 0,arguments)}f.displayName=getDisplayName(a),f.ComponentForHooksTracking=e,_defaults(f,a);var s=r.memo(i?r.forwardRef(f):f,e.compare);return s.displayName=t,_defaults(s,e),s}function patchForwardRefComponent(e,t,r,o){var n=e.render,i=n.$$typeof===REACT_MEMO_TYPE,a=i?n.type:n;function f(){var n=arguments[0],i=r.useRef(),f=i.current;if(i.current=n,f){var s=getUpdateInfo({Component:e,displayName:t,prevProps:f,nextProps:n,options:o});s.reason.propsDifferences&&s.reason.propsDifferences.length>0&&o.notifier(s)}return a.apply(void 0,arguments)}f.displayName=getDisplayName(a),f.ComponentForHooksTracking=a,_defaults(f,a);var s=r.forwardRef(i?r.memo(f,n.compare):f);return s.displayName=t,_defaults(s,e),s}function trackHookChanges(e,t,r,o,n){var i=t.path,a=r,f=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner.current;if(!f)return a;var s=f.type.ComponentForHooksTracking||f.type,c=getDisplayName(s);if(!shouldTrack(s,c,n))return a;var p=o.useRef(),u=p.current;if(p.current=a,u){var l=getUpdateInfo({Component:s,displayName:c,hookName:e,prevHook:i?_get(u,i):u,nextHook:i?_get(a,i):a,options:n});l.reason.hookDifferences&&n.notifier(l)}return p.current}function createPatchedComponent(e,t,r,o,n){return t.$$typeof===REACT_MEMO_TYPE?patchMemoComponent(t,r,o,n):t.$$typeof===REACT_FORWARD_REF_TYPE?patchForwardRefComponent(t,r,o,n):t.prototype&&t.prototype.isReactComponent?patchClassComponent(t,r,o,n):patchFunctionalComponent(t,r,o,n)}function getPatchedComponent(e,t,r,o,n){if(e.has(t))return e.get(t);var i=createPatchedComponent(e,t,r,o,n);return e.set(t,i),i}var hooksConfig={useState:{path:"0"},useReducer:{path:"0"},useContext:!0,useMemo:!0};function whyDidYouRender(e,t){var r,o=normalizeOptions(t),n=e.createElement,i=e.createFactory,a=new WeakMap;if(e.createElement=function(t){for(var r=null,i=null,f=null,s=arguments.length,c=new Array(s>1?s-1:0),p=1;p<s;p++)c[p-1]=arguments[p];try{if(r=("function"==typeof t||t.$$typeof===REACT_MEMO_TYPE||t.$$typeof===REACT_FORWARD_REF_TYPE)&&shouldTrack(t,getDisplayName(t),o))return i=t&&t.whyDidYouRender&&t.whyDidYouRender.customName||getDisplayName(t),f=getPatchedComponent(a,t,i,e,o),n.apply(e,[f].concat(c))}catch(e){o.consoleLog("whyDidYouRender error. Please file a bug at https://github.com/welldone-software/why-did-you-render/issues.",{errorInfo:{error:e,componentNameOrComponent:t,rest:c,options:o,isShouldTrack:r,displayName:i,WDYRPatchedComponent:f}})}return n.apply(e,[t].concat(c))},Object.assign(e.createElement,n),e.createFactory=function(t){var r=e.createElement.bind(null,t);return r.type=t,r},Object.assign(e.createFactory,i),o.trackHooks){var f=_mapValues(hooksConfig,function(t,n){return function(){var i=r[n];if(!i)throw new Error("[WhyDidYouRender] A problem with React Hooks patching occurred.");var a=i.apply(void 0,arguments);return t&&trackHookChanges(n,!0===t?{}:t,a,e,o),a}});Object.defineProperty(e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher,"current",{set:function(e){r=e&&_objectSpread2({},e,{},e.origHooks)},get:function(){return r&&_objectSpread2({},r,{},f,{origHooks:r})}})}return e.__REVERT_WHY_DID_YOU_RENDER__=function(){Object.assign(e,{createElement:n,createFactory:i}),a=null,Object.defineProperty(e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher,"current",{writable:!0,value:r}),delete e.__REVERT_WHY_DID_YOU_RENDER__},e}whyDidYouRender.defaultNotifier=defaultNotifier,module.exports=whyDidYouRender; | ||
//# sourceMappingURL=whyDidYouRender.min.js.map |
/** | ||
* @welldone-software/why-did-you-render 3.3.2 | ||
* @welldone-software/why-did-you-render 3.3.3 | ||
* MIT Licensed | ||
* Generated by Vitali Zaidman <vzaidman@gmail.com> (https://github.com/vzaidman) | ||
* Generated at 2019-08-09 | ||
* Generated at 2019-08-13 | ||
*/ | ||
@@ -496,3 +496,3 @@ | ||
// copied from https://github.com/facebook/react/blob/master/packages/react-reconciler/src/ReactTypeOfMode.js | ||
var StrictMode = 2; // based on "findStrictRoot" from https://github.com/facebook/react/blob/master/packages/react-reconciler/src/ReactStrictModeWarnings.js | ||
var StrictMode = 1; // based on "findStrictRoot" from https://github.com/facebook/react/blob/master/packages/react-reconciler/src/ReactStrictModeWarnings.js | ||
// notice: this is only used for class components. functional components doesn't re-rendered inside strict mode | ||
@@ -503,3 +503,3 @@ | ||
while (reactInternalFiber) { | ||
while (reactInternalFiber !== null) { | ||
if (reactInternalFiber.mode & StrictMode) { | ||
@@ -506,0 +506,0 @@ return true; |
/** | ||
* @welldone-software/why-did-you-render 3.3.2 | ||
* @welldone-software/why-did-you-render 3.3.3 | ||
* MIT Licensed | ||
* Generated by Vitali Zaidman <vzaidman@gmail.com> (https://github.com/vzaidman) | ||
* Generated at 2019-08-09 | ||
* Generated at 2019-08-13 | ||
*/ | ||
import e from"lodash/mapValues";import r from"lodash/get";import t from"lodash/isString";import n from"lodash/reduce";import o from"lodash/has";import a from"lodash/keys";import i from"lodash/isFunction";import s from"lodash/isRegExp";import f from"lodash/isDate";import c from"lodash/isPlainObject";import p from"lodash/isArray";import u from"lodash/defaults";function l(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function d(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function m(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?d(t,!0).forEach(function(r){l(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):d(t).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function h(e){return function(e){if(Array.isArray(e)){for(var r=0,t=new Array(e.length);r<e.length;r++)t[r]=e[r];return t}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var y,v={different:"different",deepEquals:"deepEquals",date:"date",regex:"regex",reactElement:"reactElement",function:"function"},g="function"==typeof Symbol&&Symbol.for,D=g?Symbol.for("react.memo"):60115,b=g?Symbol.for("react.forward_ref"):60112,_="http://bit.ly/wdyr02",R="http://bit.ly/wdyr3",E=(l(y={},v.different,"different objects."),l(y,v.deepEquals,"different objects that are equal by value."),l(y,v.date,"different date objects with the same value."),l(y,v.regex,"different regular expressions with the same value."),l(y,v.reactElement,"different React elements with the same displayName."),l(y,v.function,"different functions with the same name."),y),O=!1;function k(e){var r=e.Component,t=e.displayName,n=e.hookName,o=e.prefixMessage,a=e.diffObjType,i=e.differences,s=e.values,f=e.options;i&&i.length>0?(f.consoleLog(l({},t,r),"".concat(o," of ").concat(a," changes:")),i.forEach(function(e){var r=e.pathString,t=e.diffType,o=e.prevValue,i=e.nextValue;f.consoleGroup("%c".concat("hook"===a?"[hook ".concat(n," result]"):"".concat(a,"."),"%c").concat(r,"%c"),"color:".concat(f.diffNameColor,";"),"color:".concat(f.diffPathColor,";"),"color:default;"),f.consoleLog("".concat(E[t]," (more info at ").concat(n?R:_,")")),f.consoleLog(l({},"prev ".concat(r),o),"!==",l({},"next ".concat(r),i)),f.consoleGroupEnd()})):i&&(f.consoleLog(l({},t,r),"".concat(o," the ").concat(a," object itself changed but its values are all equal."),"props"===a?"This could have been avoided by making the component pure, or by preventing its father from re-rendering.":"This usually means this component called setState when no changes in its state actually occurred.","More info at ".concat(_)),f.consoleLog("prev ".concat(a,":"),s.prev," !== ",s.next,":next ".concat(a)))}function N(e){var r=e.Component,t=e.displayName,n=e.hookName,o=e.prevProps,a=e.prevState,i=e.prevHook,s=e.nextProps,f=e.nextState,c=e.nextHook,p=e.reason,u=e.options;if(function(e,r,t){return!(O||!t.logOnDifferentValues&&(!r.whyDidYouRender||!r.whyDidYouRender.logOnDifferentValues)&&(e.propsDifferences&&e.propsDifferences.some(function(e){return e.diffType===v.different})||e.stateDifferences&&e.stateDifferences.some(function(e){return e.diffType===v.different})||e.hookDifferences&&e.hookDifferences.some(function(e){return e.diffType===v.different})))}(p,r,u)){u.consoleGroup("%c".concat(t),"color: ".concat(u.titleColor,";"));var d="Re-rendered because";p.propsDifferences&&(k({Component:r,displayName:t,prefixMessage:d,diffObjType:"props",differences:p.propsDifferences,values:{prev:o,next:s},options:u}),d="And because"),p.stateDifferences&&k({Component:r,displayName:t,prefixMessage:d,diffObjType:"state",differences:p.stateDifferences,values:{prev:a,next:f},options:u}),p.hookDifferences&&k({Component:r,displayName:t,prefixMessage:d,diffObjType:"hook",differences:p.hookDifferences,values:{prev:i,next:c},hookName:n,options:u}),p.propsDifferences||p.stateDifferences||p.hookDifferences||u.consoleLog(l({},t,r),"Re-rendered although props and state objects are the same.","This usually means there was a call to this.forceUpdate() inside the component.","more info at ".concat(_)),u.consoleGroupEnd()}}var S=function(){};function w(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=console.group,n=console.groupEnd;return r.collapseGroups?t=console.groupCollapsed:r.onlyLogs&&(t=console.log,n=S),m({include:null,exclude:null,notifier:r.notifier||((e="hotReloadBufferMs"in r?r.hotReloadBufferMs:500)&&module&&module.hot&&module.hot.addStatusHandler&&module.hot.addStatusHandler(function(r){"idle"===r&&(O=!0,setTimeout(function(){O=!1},e))}),N),onlyLogs:!1,consoleLog:console.log,consoleGroup:t,consoleGroupEnd:n,logOnDifferentValues:!1,trackHooks:!0,titleColor:"#058",diffNameColor:"blue",diffPathColor:"red"},r)}function x(e){return e.displayName||e.name||e.type&&x(e.type)||e.render&&x(e.render)||(t(e)?e:void 0)}var C="undefined"!=typeof Element,P="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103,T=function(e){return e.$$typeof===P};function j(e,r,t,n,o){return t.push({diffType:o,pathString:n,prevValue:e,nextValue:r}),o!==v.different}function Y(e,r,t){try{var n=[];return function e(r,t,n){var u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";if(r===t)return!0;if(!r||!t)return j(r,t,n,u,v.different);if(p(r)&&p(t)){var l=r.length;if(l!==t.length)return j(r,t,n,u,v.different);for(var d=!0,m=l;0!=m--;)e(r[m],t[m],n,"".concat(u,"[").concat(m,"]"))||(d=!1);return j(r,t,n,u,d?v.deepEquals:v.different)}if(f(r)&&f(t))return r.getTime()===t.getTime()?j(r,t,n,u,v.date):j(r,t,n,u,v.different);if(s(r)&&s(t))return r.toString()===t.toString()?j(r,t,n,u,v.regex):j(r,t,n,u,v.different);if(C&&r instanceof Element&&t instanceof Element)return j(r,t,n,u,v.different);if(T(r)&&T(t))return r.type!==t.type?j(r,t,n,u,v.different):j(r,t,n,u,e(r.props,t.props,n,"".concat(u,".props"))?v.reactElement:v.different);if(i(r)&&i(t))return r.name===t.name?j(r,t,n,u,v.function):j(r,t,n,u,v.different);if(c(r)&&c(t)){var h=a(r),y=h.length;if(y!==a(t).length)return j(r,t,n,u,v.different);for(var g=y;0!=g--;)if(!o(t,h[g]))return j(r,t,n,u,v.different);for(var D=!0,b=y;0!=b--;){var _=h[b];e(r[_],t[_],n,"".concat(u,".").concat(_))||(D=!1)}return j(r,t,n,u,D?v.deepEquals:v.different)}return j(r,t,n,u,v.different)}(e,r,n,t),n}catch(e){if(e.message&&e.message.match(/stack|recursion/i)||-2146828260===e.number)return console.warn("Warning: why-did-you-render couldn't handle circular references in props.",e.name,e.message),!1;throw e}}var H={};function W(e,r){var t=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).shallow;if(e===r)return!1;if(!(void 0===t||t))return Y(e,r);var o=e||H,a=r||H,i=Object.keys(m({},o,{},a));return n(i,function(e,r){var t=Y(o[r],a[r],r);return t&&(e=[].concat(h(e),h(t))),e},[])}function L(e,r,t,n,o,a){return{propsDifferences:W(e,n),stateDifferences:W(r,o),hookDifferences:W(t,a,{shallow:!1})}}function I(e){var r=e.Component,t=e.displayName,n=e.hookName,o=e.prevProps,a=e.prevState,i=e.prevHook,s=e.nextProps,f=e.nextState,c=e.nextHook;return{Component:r,displayName:t,hookName:n,prevProps:o,prevState:a,prevHook:i,nextProps:s,nextState:f,nextHook:c,options:e.options,reason:L(o,a,i,s,f,c)}}function $(e,r,t){return!function(e,r){return r.exclude&&r.exclude.length>0&&r.exclude.some(function(r){return r.test(e)})}(r,t)&&!(!e.whyDidYouRender&&!function(e,r){return r.include&&r.include.length>0&&r.include.some(function(r){return r.test(e)})}(r,t))}var F=2;function A(e,r,t,n){class o extends e{constructor(r,t){var n;super(r,t),n=this,this._WDYR={renderNumber:0};var a=super.render||this.render;a!==e.prototype.render&&(this.render=function(){return o.prototype.render.apply(n),a()})}render(){return this._WDYR.renderNumber++,"isStrictMode"in this._WDYR||(this._WDYR.isStrictMode=function(e){for(var r=e._reactInternalFiber;r;){if(r.mode&F)return!0;r=r.return}return!1}(this)),this._WDYR.isStrictMode&&this._WDYR.renderNumber%2==1||(this._WDYR.prevProps&&n.notifier(I({Component:e,displayName:r,prevProps:this._WDYR.prevProps,prevState:this._WDYR.prevState,nextProps:this.props,nextState:this.state,options:n})),this._WDYR.prevProps=this.props,this._WDYR.prevState=this.state),super.render?super.render():null}}return o.displayName=r,u(o,e),o}function M(e,t,n,o,a){var i=t.path,s=n,f=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner.current;if(!f)return s;var c=f.type.ComponentForHooksTracking||f.type,p=x(c);if(!$(c,p,a))return s;var u=o.useRef(),l=u.current;if(u.current=s,l){var d=I({Component:c,displayName:p,hookName:e,prevHook:i?r(l,i):l,nextHook:i?r(s,i):s,options:a});d.reason.hookDifferences&&a.notifier(d)}return u.current}function V(e,r,t,n,o){return r.$$typeof===D?function(e,r,t,n){var o=e.type,a=o.$$typeof===b,i=a?o.render:o;function s(){var o=arguments[0],a=t.useRef(),s=a.current;if(a.current=o,s){var f=I({Component:e,displayName:r,prevProps:s,nextProps:o,options:n});f.reason.propsDifferences&&f.reason.propsDifferences.length>0&&n.notifier(f)}return i.apply(void 0,arguments)}s.displayName=x(i),s.ComponentForHooksTracking=e,u(s,i);var f=t.memo(a?t.forwardRef(s):s,e.compare);return f.displayName=r,u(f,e),f}(r,t,n,o):r.$$typeof===b?function(e,r,t,n){var o=e.render,a=o.$$typeof===D,i=a?o.type:o;function s(){var o=arguments[0],a=t.useRef(),s=a.current;if(a.current=o,s){var f=I({Component:e,displayName:r,prevProps:s,nextProps:o,options:n});f.reason.propsDifferences&&f.reason.propsDifferences.length>0&&n.notifier(f)}return i.apply(void 0,arguments)}s.displayName=x(i),s.ComponentForHooksTracking=i,u(s,i);var f=t.forwardRef(a?t.memo(s,o.compare):s);return f.displayName=r,u(f,e),f}(r,t,n,o):r.prototype&&r.prototype.isReactComponent?A(r,t,0,o):function(e,r,t,n){function o(o){var a=t.useRef(),i=a.current;if(a.current=o,i){var s=I({Component:e,displayName:r,prevProps:i,nextProps:o,options:n});s.reason.propsDifferences&&n.notifier(s)}return e(o)}return o.displayName=r,o.ComponentForHooksTracking=e,u(o,e),o}(r,t,n,o)}function U(e,r,t,n,o){if(e.has(r))return e.get(r);var a=V(0,r,t,n,o);return e.set(r,a),a}var q={useState:{path:"0"},useReducer:{path:"0"},useContext:!0,useMemo:!0};function G(r,t){var n,o=w(t),a=r.createElement,i=r.createFactory,s=new WeakMap;if(r.createElement=function(e){for(var t=null,n=null,i=null,f=arguments.length,c=new Array(f>1?f-1:0),p=1;p<f;p++)c[p-1]=arguments[p];try{if(t=("function"==typeof e||e.$$typeof===D||e.$$typeof===b)&&$(e,x(e),o))return n=e&&e.whyDidYouRender&&e.whyDidYouRender.customName||x(e),i=U(s,e,n,r,o),a.apply(r,[i].concat(c))}catch(r){o.consoleLog("whyDidYouRender error. Please file a bug at https://github.com/welldone-software/why-did-you-render/issues.",{errorInfo:{error:r,componentNameOrComponent:e,rest:c,options:o,isShouldTrack:t,displayName:n,WDYRPatchedComponent:i}})}return a.apply(r,[e].concat(c))},Object.assign(r.createElement,a),r.createFactory=function(e){var t=r.createElement.bind(null,e);return t.type=e,t},Object.assign(r.createFactory,i),o.trackHooks){var f=e(q,function(e,t){return function(){var a=n[t];if(!a)throw new Error("[WhyDidYouRender] A problem with React Hooks patching occurred.");var i=a.apply(void 0,arguments);return e&&M(t,!0===e?{}:e,i,r,o),i}});Object.defineProperty(r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher,"current",{set:function(e){n=e&&m({},e,{},e.origHooks)},get:function(){return n&&m({},n,{},f,{origHooks:n})}})}return r.__REVERT_WHY_DID_YOU_RENDER__=function(){Object.assign(r,{createElement:a,createFactory:i}),s=null,Object.defineProperty(r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher,"current",{writable:!0,value:n}),delete r.__REVERT_WHY_DID_YOU_RENDER__},r}G.defaultNotifier=N;export default G; | ||
import e from"lodash/mapValues";import r from"lodash/get";import t from"lodash/isString";import n from"lodash/reduce";import o from"lodash/has";import a from"lodash/keys";import i from"lodash/isFunction";import s from"lodash/isRegExp";import f from"lodash/isDate";import c from"lodash/isPlainObject";import p from"lodash/isArray";import u from"lodash/defaults";function l(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function d(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function m(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?d(t,!0).forEach(function(r){l(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):d(t).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function h(e){return function(e){if(Array.isArray(e)){for(var r=0,t=new Array(e.length);r<e.length;r++)t[r]=e[r];return t}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var y,v={different:"different",deepEquals:"deepEquals",date:"date",regex:"regex",reactElement:"reactElement",function:"function"},g="function"==typeof Symbol&&Symbol.for,D=g?Symbol.for("react.memo"):60115,b=g?Symbol.for("react.forward_ref"):60112,_="http://bit.ly/wdyr02",R="http://bit.ly/wdyr3",E=(l(y={},v.different,"different objects."),l(y,v.deepEquals,"different objects that are equal by value."),l(y,v.date,"different date objects with the same value."),l(y,v.regex,"different regular expressions with the same value."),l(y,v.reactElement,"different React elements with the same displayName."),l(y,v.function,"different functions with the same name."),y),O=!1;function k(e){var r=e.Component,t=e.displayName,n=e.hookName,o=e.prefixMessage,a=e.diffObjType,i=e.differences,s=e.values,f=e.options;i&&i.length>0?(f.consoleLog(l({},t,r),"".concat(o," of ").concat(a," changes:")),i.forEach(function(e){var r=e.pathString,t=e.diffType,o=e.prevValue,i=e.nextValue;f.consoleGroup("%c".concat("hook"===a?"[hook ".concat(n," result]"):"".concat(a,"."),"%c").concat(r,"%c"),"color:".concat(f.diffNameColor,";"),"color:".concat(f.diffPathColor,";"),"color:default;"),f.consoleLog("".concat(E[t]," (more info at ").concat(n?R:_,")")),f.consoleLog(l({},"prev ".concat(r),o),"!==",l({},"next ".concat(r),i)),f.consoleGroupEnd()})):i&&(f.consoleLog(l({},t,r),"".concat(o," the ").concat(a," object itself changed but its values are all equal."),"props"===a?"This could have been avoided by making the component pure, or by preventing its father from re-rendering.":"This usually means this component called setState when no changes in its state actually occurred.","More info at ".concat(_)),f.consoleLog("prev ".concat(a,":"),s.prev," !== ",s.next,":next ".concat(a)))}function N(e){var r=e.Component,t=e.displayName,n=e.hookName,o=e.prevProps,a=e.prevState,i=e.prevHook,s=e.nextProps,f=e.nextState,c=e.nextHook,p=e.reason,u=e.options;if(function(e,r,t){return!(O||!t.logOnDifferentValues&&(!r.whyDidYouRender||!r.whyDidYouRender.logOnDifferentValues)&&(e.propsDifferences&&e.propsDifferences.some(function(e){return e.diffType===v.different})||e.stateDifferences&&e.stateDifferences.some(function(e){return e.diffType===v.different})||e.hookDifferences&&e.hookDifferences.some(function(e){return e.diffType===v.different})))}(p,r,u)){u.consoleGroup("%c".concat(t),"color: ".concat(u.titleColor,";"));var d="Re-rendered because";p.propsDifferences&&(k({Component:r,displayName:t,prefixMessage:d,diffObjType:"props",differences:p.propsDifferences,values:{prev:o,next:s},options:u}),d="And because"),p.stateDifferences&&k({Component:r,displayName:t,prefixMessage:d,diffObjType:"state",differences:p.stateDifferences,values:{prev:a,next:f},options:u}),p.hookDifferences&&k({Component:r,displayName:t,prefixMessage:d,diffObjType:"hook",differences:p.hookDifferences,values:{prev:i,next:c},hookName:n,options:u}),p.propsDifferences||p.stateDifferences||p.hookDifferences||u.consoleLog(l({},t,r),"Re-rendered although props and state objects are the same.","This usually means there was a call to this.forceUpdate() inside the component.","more info at ".concat(_)),u.consoleGroupEnd()}}var S=function(){};function w(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=console.group,n=console.groupEnd;return r.collapseGroups?t=console.groupCollapsed:r.onlyLogs&&(t=console.log,n=S),m({include:null,exclude:null,notifier:r.notifier||((e="hotReloadBufferMs"in r?r.hotReloadBufferMs:500)&&module&&module.hot&&module.hot.addStatusHandler&&module.hot.addStatusHandler(function(r){"idle"===r&&(O=!0,setTimeout(function(){O=!1},e))}),N),onlyLogs:!1,consoleLog:console.log,consoleGroup:t,consoleGroupEnd:n,logOnDifferentValues:!1,trackHooks:!0,titleColor:"#058",diffNameColor:"blue",diffPathColor:"red"},r)}function x(e){return e.displayName||e.name||e.type&&x(e.type)||e.render&&x(e.render)||(t(e)?e:void 0)}var C="undefined"!=typeof Element,P="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103,T=function(e){return e.$$typeof===P};function j(e,r,t,n,o){return t.push({diffType:o,pathString:n,prevValue:e,nextValue:r}),o!==v.different}function Y(e,r,t){try{var n=[];return function e(r,t,n){var u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";if(r===t)return!0;if(!r||!t)return j(r,t,n,u,v.different);if(p(r)&&p(t)){var l=r.length;if(l!==t.length)return j(r,t,n,u,v.different);for(var d=!0,m=l;0!=m--;)e(r[m],t[m],n,"".concat(u,"[").concat(m,"]"))||(d=!1);return j(r,t,n,u,d?v.deepEquals:v.different)}if(f(r)&&f(t))return r.getTime()===t.getTime()?j(r,t,n,u,v.date):j(r,t,n,u,v.different);if(s(r)&&s(t))return r.toString()===t.toString()?j(r,t,n,u,v.regex):j(r,t,n,u,v.different);if(C&&r instanceof Element&&t instanceof Element)return j(r,t,n,u,v.different);if(T(r)&&T(t))return r.type!==t.type?j(r,t,n,u,v.different):j(r,t,n,u,e(r.props,t.props,n,"".concat(u,".props"))?v.reactElement:v.different);if(i(r)&&i(t))return r.name===t.name?j(r,t,n,u,v.function):j(r,t,n,u,v.different);if(c(r)&&c(t)){var h=a(r),y=h.length;if(y!==a(t).length)return j(r,t,n,u,v.different);for(var g=y;0!=g--;)if(!o(t,h[g]))return j(r,t,n,u,v.different);for(var D=!0,b=y;0!=b--;){var _=h[b];e(r[_],t[_],n,"".concat(u,".").concat(_))||(D=!1)}return j(r,t,n,u,D?v.deepEquals:v.different)}return j(r,t,n,u,v.different)}(e,r,n,t),n}catch(e){if(e.message&&e.message.match(/stack|recursion/i)||-2146828260===e.number)return console.warn("Warning: why-did-you-render couldn't handle circular references in props.",e.name,e.message),!1;throw e}}var H={};function W(e,r){var t=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).shallow;if(e===r)return!1;if(!(void 0===t||t))return Y(e,r);var o=e||H,a=r||H,i=Object.keys(m({},o,{},a));return n(i,function(e,r){var t=Y(o[r],a[r],r);return t&&(e=[].concat(h(e),h(t))),e},[])}function L(e,r,t,n,o,a){return{propsDifferences:W(e,n),stateDifferences:W(r,o),hookDifferences:W(t,a,{shallow:!1})}}function I(e){var r=e.Component,t=e.displayName,n=e.hookName,o=e.prevProps,a=e.prevState,i=e.prevHook,s=e.nextProps,f=e.nextState,c=e.nextHook;return{Component:r,displayName:t,hookName:n,prevProps:o,prevState:a,prevHook:i,nextProps:s,nextState:f,nextHook:c,options:e.options,reason:L(o,a,i,s,f,c)}}function $(e,r,t){return!function(e,r){return r.exclude&&r.exclude.length>0&&r.exclude.some(function(r){return r.test(e)})}(r,t)&&!(!e.whyDidYouRender&&!function(e,r){return r.include&&r.include.length>0&&r.include.some(function(r){return r.test(e)})}(r,t))}var F=1;function A(e,r,t,n){class o extends e{constructor(r,t){var n;super(r,t),n=this,this._WDYR={renderNumber:0};var a=super.render||this.render;a!==e.prototype.render&&(this.render=function(){return o.prototype.render.apply(n),a()})}render(){return this._WDYR.renderNumber++,"isStrictMode"in this._WDYR||(this._WDYR.isStrictMode=function(e){for(var r=e._reactInternalFiber;null!==r;){if(r.mode&F)return!0;r=r.return}return!1}(this)),this._WDYR.isStrictMode&&this._WDYR.renderNumber%2==1||(this._WDYR.prevProps&&n.notifier(I({Component:e,displayName:r,prevProps:this._WDYR.prevProps,prevState:this._WDYR.prevState,nextProps:this.props,nextState:this.state,options:n})),this._WDYR.prevProps=this.props,this._WDYR.prevState=this.state),super.render?super.render():null}}return o.displayName=r,u(o,e),o}function M(e,t,n,o,a){var i=t.path,s=n,f=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner.current;if(!f)return s;var c=f.type.ComponentForHooksTracking||f.type,p=x(c);if(!$(c,p,a))return s;var u=o.useRef(),l=u.current;if(u.current=s,l){var d=I({Component:c,displayName:p,hookName:e,prevHook:i?r(l,i):l,nextHook:i?r(s,i):s,options:a});d.reason.hookDifferences&&a.notifier(d)}return u.current}function V(e,r,t,n,o){return r.$$typeof===D?function(e,r,t,n){var o=e.type,a=o.$$typeof===b,i=a?o.render:o;function s(){var o=arguments[0],a=t.useRef(),s=a.current;if(a.current=o,s){var f=I({Component:e,displayName:r,prevProps:s,nextProps:o,options:n});f.reason.propsDifferences&&f.reason.propsDifferences.length>0&&n.notifier(f)}return i.apply(void 0,arguments)}s.displayName=x(i),s.ComponentForHooksTracking=e,u(s,i);var f=t.memo(a?t.forwardRef(s):s,e.compare);return f.displayName=r,u(f,e),f}(r,t,n,o):r.$$typeof===b?function(e,r,t,n){var o=e.render,a=o.$$typeof===D,i=a?o.type:o;function s(){var o=arguments[0],a=t.useRef(),s=a.current;if(a.current=o,s){var f=I({Component:e,displayName:r,prevProps:s,nextProps:o,options:n});f.reason.propsDifferences&&f.reason.propsDifferences.length>0&&n.notifier(f)}return i.apply(void 0,arguments)}s.displayName=x(i),s.ComponentForHooksTracking=i,u(s,i);var f=t.forwardRef(a?t.memo(s,o.compare):s);return f.displayName=r,u(f,e),f}(r,t,n,o):r.prototype&&r.prototype.isReactComponent?A(r,t,0,o):function(e,r,t,n){function o(o){var a=t.useRef(),i=a.current;if(a.current=o,i){var s=I({Component:e,displayName:r,prevProps:i,nextProps:o,options:n});s.reason.propsDifferences&&n.notifier(s)}return e(o)}return o.displayName=r,o.ComponentForHooksTracking=e,u(o,e),o}(r,t,n,o)}function U(e,r,t,n,o){if(e.has(r))return e.get(r);var a=V(0,r,t,n,o);return e.set(r,a),a}var q={useState:{path:"0"},useReducer:{path:"0"},useContext:!0,useMemo:!0};function G(r,t){var n,o=w(t),a=r.createElement,i=r.createFactory,s=new WeakMap;if(r.createElement=function(e){for(var t=null,n=null,i=null,f=arguments.length,c=new Array(f>1?f-1:0),p=1;p<f;p++)c[p-1]=arguments[p];try{if(t=("function"==typeof e||e.$$typeof===D||e.$$typeof===b)&&$(e,x(e),o))return n=e&&e.whyDidYouRender&&e.whyDidYouRender.customName||x(e),i=U(s,e,n,r,o),a.apply(r,[i].concat(c))}catch(r){o.consoleLog("whyDidYouRender error. Please file a bug at https://github.com/welldone-software/why-did-you-render/issues.",{errorInfo:{error:r,componentNameOrComponent:e,rest:c,options:o,isShouldTrack:t,displayName:n,WDYRPatchedComponent:i}})}return a.apply(r,[e].concat(c))},Object.assign(r.createElement,a),r.createFactory=function(e){var t=r.createElement.bind(null,e);return t.type=e,t},Object.assign(r.createFactory,i),o.trackHooks){var f=e(q,function(e,t){return function(){var a=n[t];if(!a)throw new Error("[WhyDidYouRender] A problem with React Hooks patching occurred.");var i=a.apply(void 0,arguments);return e&&M(t,!0===e?{}:e,i,r,o),i}});Object.defineProperty(r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher,"current",{set:function(e){n=e&&m({},e,{},e.origHooks)},get:function(){return n&&m({},n,{},f,{origHooks:n})}})}return r.__REVERT_WHY_DID_YOU_RENDER__=function(){Object.assign(r,{createElement:a,createFactory:i}),s=null,Object.defineProperty(r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher,"current",{writable:!0,value:n}),delete r.__REVERT_WHY_DID_YOU_RENDER__},r}G.defaultNotifier=N;export default G; | ||
//# sourceMappingURL=whyDidYouRender.min.js.map |
/** | ||
* @welldone-software/why-did-you-render 3.3.2 | ||
* @welldone-software/why-did-you-render 3.3.3 | ||
* MIT Licensed | ||
* Generated by Vitali Zaidman <vzaidman@gmail.com> (https://github.com/vzaidman) | ||
* Generated at 2019-08-09 | ||
* Generated at 2019-08-13 | ||
*/ | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(e=e||self).whyDidYouRender=r()}(this,function(){"use strict";function e(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function r(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function t(t){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?r(o,!0).forEach(function(r){e(t,r,o[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):r(o).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))})}return t}function n(e){return function(e){if(Array.isArray(e)){for(var r=0,t=new Array(e.length);r<e.length;r++)t[r]=e[r];return t}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function a(e,r){return e(r={exports:{}},r.exports),r.exports}var i="object"==typeof o&&o&&o.Object===Object&&o,u="object"==typeof self&&self&&self.Object===Object&&self,c=i||u||Function("return this")(),f=c.Symbol,s=Object.prototype,l=s.hasOwnProperty,p=s.toString,v=f?f.toStringTag:void 0;var d=function(e){var r=l.call(e,v),t=e[v];try{e[v]=void 0;var n=!0}catch(e){}var o=p.call(e);return n&&(r?e[v]=t:delete e[v]),o},h=Object.prototype.toString;var y=function(e){return h.call(e)},b="[object Null]",_="[object Undefined]",g=f?f.toStringTag:void 0;var m=function(e){return null==e?void 0===e?_:b:g&&g in Object(e)?d(e):y(e)};var j=function(e){var r=typeof e;return null!=e&&("object"==r||"function"==r)},O="[object AsyncFunction]",w="[object Function]",D="[object GeneratorFunction]",E="[object Proxy]";var S,R=function(e){if(!j(e))return!1;var r=m(e);return r==w||r==D||r==O||r==E},k=c["__core-js_shared__"],x=(S=/[^.]+$/.exec(k&&k.keys&&k.keys.IE_PROTO||""))?"Symbol(src)_1."+S:"";var P=function(e){return!!x&&x in e},N=Function.prototype.toString;var T=function(e){if(null!=e){try{return N.call(e)}catch(e){}try{return e+""}catch(e){}}return""},A=/^\[object .+?Constructor\]$/,C=Function.prototype,Y=Object.prototype,z=C.toString,L=Y.hasOwnProperty,W=RegExp("^"+z.call(L).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var $=function(e){return!(!j(e)||P(e))&&(R(e)?W:A).test(T(e))};var F=function(e,r){return null==e?void 0:e[r]};var M=function(e,r){var t=F(e,r);return $(t)?t:void 0},H=function(){try{var e=M(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var I=function(e,r,t){"__proto__"==r&&H?H(e,r,{configurable:!0,enumerable:!0,value:t,writable:!0}):e[r]=t};var U=function(e){return function(r,t,n){for(var o=-1,a=Object(r),i=n(r),u=i.length;u--;){var c=i[e?u:++o];if(!1===t(a[c],c,a))break}return r}}();var V=function(e,r){for(var t=-1,n=Array(e);++t<e;)n[t]=r(t);return n};var B=function(e){return null!=e&&"object"==typeof e},q="[object Arguments]";var G=function(e){return B(e)&&m(e)==q},J=Object.prototype,K=J.hasOwnProperty,Q=J.propertyIsEnumerable,X=G(function(){return arguments}())?G:function(e){return B(e)&&K.call(e,"callee")&&!Q.call(e,"callee")},Z=Array.isArray;var ee=function(){return!1},re=a(function(e,r){var t=r&&!r.nodeType&&r,n=t&&e&&!e.nodeType&&e,o=n&&n.exports===t?c.Buffer:void 0,a=(o?o.isBuffer:void 0)||ee;e.exports=a}),te=9007199254740991,ne=/^(?:0|[1-9]\d*)$/;var oe=function(e,r){var t=typeof e;return!!(r=null==r?te:r)&&("number"==t||"symbol"!=t&&ne.test(e))&&e>-1&&e%1==0&&e<r},ae=9007199254740991;var ie=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=ae},ue={};ue["[object Float32Array]"]=ue["[object Float64Array]"]=ue["[object Int8Array]"]=ue["[object Int16Array]"]=ue["[object Int32Array]"]=ue["[object Uint8Array]"]=ue["[object Uint8ClampedArray]"]=ue["[object Uint16Array]"]=ue["[object Uint32Array]"]=!0,ue["[object Arguments]"]=ue["[object Array]"]=ue["[object ArrayBuffer]"]=ue["[object Boolean]"]=ue["[object DataView]"]=ue["[object Date]"]=ue["[object Error]"]=ue["[object Function]"]=ue["[object Map]"]=ue["[object Number]"]=ue["[object Object]"]=ue["[object RegExp]"]=ue["[object Set]"]=ue["[object String]"]=ue["[object WeakMap]"]=!1;var ce=function(e){return B(e)&&ie(e.length)&&!!ue[m(e)]};var fe=function(e){return function(r){return e(r)}},se=a(function(e,r){var t=r&&!r.nodeType&&r,n=t&&e&&!e.nodeType&&e,o=n&&n.exports===t&&i.process,a=function(){try{var e=n&&n.require&&n.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=a}),le=se&&se.isTypedArray,pe=le?fe(le):ce,ve=Object.prototype.hasOwnProperty;var de=function(e,r){var t=Z(e),n=!t&&X(e),o=!t&&!n&&re(e),a=!t&&!n&&!o&&pe(e),i=t||n||o||a,u=i?V(e.length,String):[],c=u.length;for(var f in e)!r&&!ve.call(e,f)||i&&("length"==f||o&&("offset"==f||"parent"==f)||a&&("buffer"==f||"byteLength"==f||"byteOffset"==f)||oe(f,c))||u.push(f);return u},he=Object.prototype;var ye=function(e){var r=e&&e.constructor;return e===("function"==typeof r&&r.prototype||he)};var be=function(e,r){return function(t){return e(r(t))}},_e=be(Object.keys,Object),ge=Object.prototype.hasOwnProperty;var me=function(e){if(!ye(e))return _e(e);var r=[];for(var t in Object(e))ge.call(e,t)&&"constructor"!=t&&r.push(t);return r};var je=function(e){return null!=e&&ie(e.length)&&!R(e)};var Oe=function(e){return je(e)?de(e):me(e)};var we=function(e,r){return e&&U(e,r,Oe)};var De=function(){this.__data__=[],this.size=0};var Ee=function(e,r){return e===r||e!=e&&r!=r};var Se=function(e,r){for(var t=e.length;t--;)if(Ee(e[t][0],r))return t;return-1},Re=Array.prototype.splice;var ke=function(e){var r=this.__data__,t=Se(r,e);return!(t<0||(t==r.length-1?r.pop():Re.call(r,t,1),--this.size,0))};var xe=function(e){var r=this.__data__,t=Se(r,e);return t<0?void 0:r[t][1]};var Pe=function(e){return Se(this.__data__,e)>-1};var Ne=function(e,r){var t=this.__data__,n=Se(t,e);return n<0?(++this.size,t.push([e,r])):t[n][1]=r,this};function Te(e){var r=-1,t=null==e?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}Te.prototype.clear=De,Te.prototype.delete=ke,Te.prototype.get=xe,Te.prototype.has=Pe,Te.prototype.set=Ne;var Ae=Te;var Ce=function(){this.__data__=new Ae,this.size=0};var Ye=function(e){var r=this.__data__,t=r.delete(e);return this.size=r.size,t};var ze=function(e){return this.__data__.get(e)};var Le=function(e){return this.__data__.has(e)},We=M(c,"Map"),$e=M(Object,"create");var Fe=function(){this.__data__=$e?$e(null):{},this.size=0};var Me=function(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r},He="__lodash_hash_undefined__",Ie=Object.prototype.hasOwnProperty;var Ue=function(e){var r=this.__data__;if($e){var t=r[e];return t===He?void 0:t}return Ie.call(r,e)?r[e]:void 0},Ve=Object.prototype.hasOwnProperty;var Be=function(e){var r=this.__data__;return $e?void 0!==r[e]:Ve.call(r,e)},qe="__lodash_hash_undefined__";var Ge=function(e,r){var t=this.__data__;return this.size+=this.has(e)?0:1,t[e]=$e&&void 0===r?qe:r,this};function Je(e){var r=-1,t=null==e?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}Je.prototype.clear=Fe,Je.prototype.delete=Me,Je.prototype.get=Ue,Je.prototype.has=Be,Je.prototype.set=Ge;var Ke=Je;var Qe=function(){this.size=0,this.__data__={hash:new Ke,map:new(We||Ae),string:new Ke}};var Xe=function(e){var r=typeof e;return"string"==r||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==e:null===e};var Ze=function(e,r){var t=e.__data__;return Xe(r)?t["string"==typeof r?"string":"hash"]:t.map};var er=function(e){var r=Ze(this,e).delete(e);return this.size-=r?1:0,r};var rr=function(e){return Ze(this,e).get(e)};var tr=function(e){return Ze(this,e).has(e)};var nr=function(e,r){var t=Ze(this,e),n=t.size;return t.set(e,r),this.size+=t.size==n?0:1,this};function or(e){var r=-1,t=null==e?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}or.prototype.clear=Qe,or.prototype.delete=er,or.prototype.get=rr,or.prototype.has=tr,or.prototype.set=nr;var ar=or,ir=200;var ur=function(e,r){var t=this.__data__;if(t instanceof Ae){var n=t.__data__;if(!We||n.length<ir-1)return n.push([e,r]),this.size=++t.size,this;t=this.__data__=new ar(n)}return t.set(e,r),this.size=t.size,this};function cr(e){var r=this.__data__=new Ae(e);this.size=r.size}cr.prototype.clear=Ce,cr.prototype.delete=Ye,cr.prototype.get=ze,cr.prototype.has=Le,cr.prototype.set=ur;var fr=cr,sr="__lodash_hash_undefined__";var lr=function(e){return this.__data__.set(e,sr),this};var pr=function(e){return this.__data__.has(e)};function vr(e){var r=-1,t=null==e?0:e.length;for(this.__data__=new ar;++r<t;)this.add(e[r])}vr.prototype.add=vr.prototype.push=lr,vr.prototype.has=pr;var dr=vr;var hr=function(e,r){for(var t=-1,n=null==e?0:e.length;++t<n;)if(r(e[t],t,e))return!0;return!1};var yr=function(e,r){return e.has(r)},br=1,_r=2;var gr=function(e,r,t,n,o,a){var i=t&br,u=e.length,c=r.length;if(u!=c&&!(i&&c>u))return!1;var f=a.get(e);if(f&&a.get(r))return f==r;var s=-1,l=!0,p=t&_r?new dr:void 0;for(a.set(e,r),a.set(r,e);++s<u;){var v=e[s],d=r[s];if(n)var h=i?n(d,v,s,r,e,a):n(v,d,s,e,r,a);if(void 0!==h){if(h)continue;l=!1;break}if(p){if(!hr(r,function(e,r){if(!yr(p,r)&&(v===e||o(v,e,t,n,a)))return p.push(r)})){l=!1;break}}else if(v!==d&&!o(v,d,t,n,a)){l=!1;break}}return a.delete(e),a.delete(r),l},mr=c.Uint8Array;var jr=function(e){var r=-1,t=Array(e.size);return e.forEach(function(e,n){t[++r]=[n,e]}),t};var Or=function(e){var r=-1,t=Array(e.size);return e.forEach(function(e){t[++r]=e}),t},wr=1,Dr=2,Er="[object Boolean]",Sr="[object Date]",Rr="[object Error]",kr="[object Map]",xr="[object Number]",Pr="[object RegExp]",Nr="[object Set]",Tr="[object String]",Ar="[object Symbol]",Cr="[object ArrayBuffer]",Yr="[object DataView]",zr=f?f.prototype:void 0,Lr=zr?zr.valueOf:void 0;var Wr=function(e,r,t,n,o,a,i){switch(t){case Yr:if(e.byteLength!=r.byteLength||e.byteOffset!=r.byteOffset)return!1;e=e.buffer,r=r.buffer;case Cr:return!(e.byteLength!=r.byteLength||!a(new mr(e),new mr(r)));case Er:case Sr:case xr:return Ee(+e,+r);case Rr:return e.name==r.name&&e.message==r.message;case Pr:case Tr:return e==r+"";case kr:var u=jr;case Nr:var c=n≀if(u||(u=Or),e.size!=r.size&&!c)return!1;var f=i.get(e);if(f)return f==r;n|=Dr,i.set(e,r);var s=gr(u(e),u(r),n,o,a,i);return i.delete(e),s;case Ar:if(Lr)return Lr.call(e)==Lr.call(r)}return!1};var $r=function(e,r){for(var t=-1,n=r.length,o=e.length;++t<n;)e[o+t]=r[t];return e};var Fr=function(e,r,t){var n=r(e);return Z(e)?n:$r(n,t(e))};var Mr=function(e,r){for(var t=-1,n=null==e?0:e.length,o=0,a=[];++t<n;){var i=e[t];r(i,t,e)&&(a[o++]=i)}return a};var Hr=function(){return[]},Ir=Object.prototype.propertyIsEnumerable,Ur=Object.getOwnPropertySymbols,Vr=Ur?function(e){return null==e?[]:(e=Object(e),Mr(Ur(e),function(r){return Ir.call(e,r)}))}:Hr;var Br=function(e){return Fr(e,Oe,Vr)},qr=1,Gr=Object.prototype.hasOwnProperty;var Jr=function(e,r,t,n,o,a){var i=t&qr,u=Br(e),c=u.length;if(c!=Br(r).length&&!i)return!1;for(var f=c;f--;){var s=u[f];if(!(i?s in r:Gr.call(r,s)))return!1}var l=a.get(e);if(l&&a.get(r))return l==r;var p=!0;a.set(e,r),a.set(r,e);for(var v=i;++f<c;){var d=e[s=u[f]],h=r[s];if(n)var y=i?n(h,d,s,r,e,a):n(d,h,s,e,r,a);if(!(void 0===y?d===h||o(d,h,t,n,a):y)){p=!1;break}v||(v="constructor"==s)}if(p&&!v){var b=e.constructor,_=r.constructor;b!=_&&"constructor"in e&&"constructor"in r&&!("function"==typeof b&&b instanceof b&&"function"==typeof _&&_ instanceof _)&&(p=!1)}return a.delete(e),a.delete(r),p},Kr=M(c,"DataView"),Qr=M(c,"Promise"),Xr=M(c,"Set"),Zr=M(c,"WeakMap"),et=T(Kr),rt=T(We),tt=T(Qr),nt=T(Xr),ot=T(Zr),at=m;(Kr&&"[object DataView]"!=at(new Kr(new ArrayBuffer(1)))||We&&"[object Map]"!=at(new We)||Qr&&"[object Promise]"!=at(Qr.resolve())||Xr&&"[object Set]"!=at(new Xr)||Zr&&"[object WeakMap]"!=at(new Zr))&&(at=function(e){var r=m(e),t="[object Object]"==r?e.constructor:void 0,n=t?T(t):"";if(n)switch(n){case et:return"[object DataView]";case rt:return"[object Map]";case tt:return"[object Promise]";case nt:return"[object Set]";case ot:return"[object WeakMap]"}return r});var it=at,ut=1,ct="[object Arguments]",ft="[object Array]",st="[object Object]",lt=Object.prototype.hasOwnProperty;var pt=function(e,r,t,n,o,a){var i=Z(e),u=Z(r),c=i?ft:it(e),f=u?ft:it(r),s=(c=c==ct?st:c)==st,l=(f=f==ct?st:f)==st,p=c==f;if(p&&re(e)){if(!re(r))return!1;i=!0,s=!1}if(p&&!s)return a||(a=new fr),i||pe(e)?gr(e,r,t,n,o,a):Wr(e,r,c,t,n,o,a);if(!(t&ut)){var v=s&<.call(e,"__wrapped__"),d=l&<.call(r,"__wrapped__");if(v||d){var h=v?e.value():e,y=d?r.value():r;return a||(a=new fr),o(h,y,t,n,a)}}return!!p&&(a||(a=new fr),Jr(e,r,t,n,o,a))};var vt=function e(r,t,n,o,a){return r===t||(null==r||null==t||!B(r)&&!B(t)?r!=r&&t!=t:pt(r,t,n,o,e,a))},dt=1,ht=2;var yt=function(e,r,t,n){var o=t.length,a=o,i=!n;if(null==e)return!a;for(e=Object(e);o--;){var u=t[o];if(i&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++o<a;){var c=(u=t[o])[0],f=e[c],s=u[1];if(i&&u[2]){if(void 0===f&&!(c in e))return!1}else{var l=new fr;if(n)var p=n(f,s,c,e,r,l);if(!(void 0===p?vt(s,f,dt|ht,n,l):p))return!1}}return!0};var bt=function(e){return e==e&&!j(e)};var _t=function(e){for(var r=Oe(e),t=r.length;t--;){var n=r[t],o=e[n];r[t]=[n,o,bt(o)]}return r};var gt=function(e,r){return function(t){return null!=t&&t[e]===r&&(void 0!==r||e in Object(t))}};var mt=function(e){var r=_t(e);return 1==r.length&&r[0][2]?gt(r[0][0],r[0][1]):function(t){return t===e||yt(t,e,r)}},jt="[object Symbol]";var Ot=function(e){return"symbol"==typeof e||B(e)&&m(e)==jt},wt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Dt=/^\w*$/;var Et=function(e,r){if(Z(e))return!1;var t=typeof e;return!("number"!=t&&"symbol"!=t&&"boolean"!=t&&null!=e&&!Ot(e))||Dt.test(e)||!wt.test(e)||null!=r&&e in Object(r)},St="Expected a function";function Rt(e,r){if("function"!=typeof e||null!=r&&"function"!=typeof r)throw new TypeError(St);var t=function(){var n=arguments,o=r?r.apply(this,n):n[0],a=t.cache;if(a.has(o))return a.get(o);var i=e.apply(this,n);return t.cache=a.set(o,i)||a,i};return t.cache=new(Rt.Cache||ar),t}Rt.Cache=ar;var kt=Rt,xt=500;var Pt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Nt=/\\(\\)?/g,Tt=function(e){var r=kt(e,function(e){return t.size===xt&&t.clear(),e}),t=r.cache;return r}(function(e){var r=[];return 46===e.charCodeAt(0)&&r.push(""),e.replace(Pt,function(e,t,n,o){r.push(n?o.replace(Nt,"$1"):t||e)}),r});var At=function(e,r){for(var t=-1,n=null==e?0:e.length,o=Array(n);++t<n;)o[t]=r(e[t],t,e);return o},Ct=1/0,Yt=f?f.prototype:void 0,zt=Yt?Yt.toString:void 0;var Lt=function e(r){if("string"==typeof r)return r;if(Z(r))return At(r,e)+"";if(Ot(r))return zt?zt.call(r):"";var t=r+"";return"0"==t&&1/r==-Ct?"-0":t};var Wt=function(e){return null==e?"":Lt(e)};var $t=function(e,r){return Z(e)?e:Et(e,r)?[e]:Tt(Wt(e))},Ft=1/0;var Mt=function(e){if("string"==typeof e||Ot(e))return e;var r=e+"";return"0"==r&&1/e==-Ft?"-0":r};var Ht=function(e,r){for(var t=0,n=(r=$t(r,e)).length;null!=e&&t<n;)e=e[Mt(r[t++])];return t&&t==n?e:void 0};var It=function(e,r,t){var n=null==e?void 0:Ht(e,r);return void 0===n?t:n};var Ut=function(e,r){return null!=e&&r in Object(e)};var Vt=function(e,r,t){for(var n=-1,o=(r=$t(r,e)).length,a=!1;++n<o;){var i=Mt(r[n]);if(!(a=null!=e&&t(e,i)))break;e=e[i]}return a||++n!=o?a:!!(o=null==e?0:e.length)&&ie(o)&&oe(i,o)&&(Z(e)||X(e))};var Bt=function(e,r){return null!=e&&Vt(e,r,Ut)},qt=1,Gt=2;var Jt=function(e,r){return Et(e)&&bt(r)?gt(Mt(e),r):function(t){var n=It(t,e);return void 0===n&&n===r?Bt(t,e):vt(r,n,qt|Gt)}};var Kt=function(e){return e};var Qt=function(e){return function(r){return null==r?void 0:r[e]}};var Xt=function(e){return function(r){return Ht(r,e)}};var Zt=function(e){return Et(e)?Qt(Mt(e)):Xt(e)};var en=function(e){return"function"==typeof e?e:null==e?Kt:"object"==typeof e?Z(e)?Jt(e[0],e[1]):mt(e):Zt(e)};var rn,tn=function(e,r){var t={};return r=en(r),we(e,function(e,n,o){I(t,n,r(e,n,o))}),t},nn={different:"different",deepEquals:"deepEquals",date:"date",regex:"regex",reactElement:"reactElement",function:"function"},on="function"==typeof Symbol&&Symbol.for,an=on?Symbol.for("react.memo"):60115,un=on?Symbol.for("react.forward_ref"):60112,cn="http://bit.ly/wdyr02",fn="http://bit.ly/wdyr3",sn=(e(rn={},nn.different,"different objects."),e(rn,nn.deepEquals,"different objects that are equal by value."),e(rn,nn.date,"different date objects with the same value."),e(rn,nn.regex,"different regular expressions with the same value."),e(rn,nn.reactElement,"different React elements with the same displayName."),e(rn,nn.function,"different functions with the same name."),rn),ln=!1;function pn(r){var t=r.Component,n=r.displayName,o=r.hookName,a=r.prefixMessage,i=r.diffObjType,u=r.differences,c=r.values,f=r.options;u&&u.length>0?(f.consoleLog(e({},n,t),"".concat(a," of ").concat(i," changes:")),u.forEach(function(r){var t=r.pathString,n=r.diffType,a=r.prevValue,u=r.nextValue;f.consoleGroup("%c".concat("hook"===i?"[hook ".concat(o," result]"):"".concat(i,"."),"%c").concat(t,"%c"),"color:".concat(f.diffNameColor,";"),"color:".concat(f.diffPathColor,";"),"color:default;"),f.consoleLog("".concat(sn[n]," (more info at ").concat(o?fn:cn,")")),f.consoleLog(e({},"prev ".concat(t),a),"!==",e({},"next ".concat(t),u)),f.consoleGroupEnd()})):u&&(f.consoleLog(e({},n,t),"".concat(a," the ").concat(i," object itself changed but its values are all equal."),"props"===i?"This could have been avoided by making the component pure, or by preventing its father from re-rendering.":"This usually means this component called setState when no changes in its state actually occurred.","More info at ".concat(cn)),f.consoleLog("prev ".concat(i,":"),c.prev," !== ",c.next,":next ".concat(i)))}function vn(r){var t=r.Component,n=r.displayName,o=r.hookName,a=r.prevProps,i=r.prevState,u=r.prevHook,c=r.nextProps,f=r.nextState,s=r.nextHook,l=r.reason,p=r.options;if(function(e,r,t){return!(ln||!t.logOnDifferentValues&&(!r.whyDidYouRender||!r.whyDidYouRender.logOnDifferentValues)&&(e.propsDifferences&&e.propsDifferences.some(function(e){return e.diffType===nn.different})||e.stateDifferences&&e.stateDifferences.some(function(e){return e.diffType===nn.different})||e.hookDifferences&&e.hookDifferences.some(function(e){return e.diffType===nn.different})))}(l,t,p)){p.consoleGroup("%c".concat(n),"color: ".concat(p.titleColor,";"));var v="Re-rendered because";l.propsDifferences&&(pn({Component:t,displayName:n,prefixMessage:v,diffObjType:"props",differences:l.propsDifferences,values:{prev:a,next:c},options:p}),v="And because"),l.stateDifferences&&pn({Component:t,displayName:n,prefixMessage:v,diffObjType:"state",differences:l.stateDifferences,values:{prev:i,next:f},options:p}),l.hookDifferences&&pn({Component:t,displayName:n,prefixMessage:v,diffObjType:"hook",differences:l.hookDifferences,values:{prev:u,next:s},hookName:o,options:p}),l.propsDifferences||l.stateDifferences||l.hookDifferences||p.consoleLog(e({},n,t),"Re-rendered although props and state objects are the same.","This usually means there was a call to this.forceUpdate() inside the component.","more info at ".concat(cn)),p.consoleGroupEnd()}}var dn=function(){};function hn(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=console.group,o=console.groupEnd;return r.collapseGroups?n=console.groupCollapsed:r.onlyLogs&&(n=console.log,o=dn),t({include:null,exclude:null,notifier:r.notifier||((e="hotReloadBufferMs"in r?r.hotReloadBufferMs:500)&&module&&module.hot&&module.hot.addStatusHandler&&module.hot.addStatusHandler(function(r){"idle"===r&&(ln=!0,setTimeout(function(){ln=!1},e))}),vn),onlyLogs:!1,consoleLog:console.log,consoleGroup:n,consoleGroupEnd:o,logOnDifferentValues:!1,trackHooks:!0,titleColor:"#058",diffNameColor:"blue",diffPathColor:"red"},r)}var yn="[object String]";var bn=function(e){return"string"==typeof e||!Z(e)&&B(e)&&m(e)==yn};function _n(e){return e.displayName||e.name||e.type&&_n(e.type)||e.render&&_n(e.render)||(bn(e)?e:void 0)}var gn=function(e,r,t,n){var o=-1,a=null==e?0:e.length;for(n&&a&&(t=e[++o]);++o<a;)t=r(t,e[o],o,e);return t};var mn=function(e,r){return function(t,n){if(null==t)return t;if(!je(t))return e(t,n);for(var o=t.length,a=r?o:-1,i=Object(t);(r?a--:++a<o)&&!1!==n(i[a],a,i););return t}}(we);var jn=function(e,r,t,n,o){return o(e,function(e,o,a){t=n?(n=!1,e):r(t,e,o,a)}),t};var On=function(e,r,t){var n=Z(e)?gn:jn,o=arguments.length<3;return n(e,en(r),t,o,mn)},wn=Object.prototype.hasOwnProperty;var Dn=function(e,r){return null!=e&&wn.call(e,r)};var En=function(e,r){return null!=e&&Vt(e,r,Dn)},Sn="[object RegExp]";var Rn=function(e){return B(e)&&m(e)==Sn},kn=se&&se.isRegExp,xn=kn?fe(kn):Rn,Pn="[object Date]";var Nn=function(e){return B(e)&&m(e)==Pn},Tn=se&&se.isDate,An=Tn?fe(Tn):Nn,Cn=be(Object.getPrototypeOf,Object),Yn="[object Object]",zn=Function.prototype,Ln=Object.prototype,Wn=zn.toString,$n=Ln.hasOwnProperty,Fn=Wn.call(Object);var Mn=function(e){if(!B(e)||m(e)!=Yn)return!1;var r=Cn(e);if(null===r)return!0;var t=$n.call(r,"constructor")&&r.constructor;return"function"==typeof t&&t instanceof t&&Wn.call(t)==Fn},Hn="undefined"!=typeof Element,In="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103,Un=function(e){return e.$$typeof===In};function Vn(e,r,t,n,o){return t.push({diffType:o,pathString:n,prevValue:e,nextValue:r}),o!==nn.different}function Bn(e,r,t){try{var n=[];return function e(r,t,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";if(r===t)return!0;if(!r||!t)return Vn(r,t,n,o,nn.different);if(Z(r)&&Z(t)){var a=r.length;if(a!==t.length)return Vn(r,t,n,o,nn.different);for(var i=!0,u=a;0!=u--;)e(r[u],t[u],n,"".concat(o,"[").concat(u,"]"))||(i=!1);return Vn(r,t,n,o,i?nn.deepEquals:nn.different)}if(An(r)&&An(t))return r.getTime()===t.getTime()?Vn(r,t,n,o,nn.date):Vn(r,t,n,o,nn.different);if(xn(r)&&xn(t))return r.toString()===t.toString()?Vn(r,t,n,o,nn.regex):Vn(r,t,n,o,nn.different);if(Hn&&r instanceof Element&&t instanceof Element)return Vn(r,t,n,o,nn.different);if(Un(r)&&Un(t))return r.type!==t.type?Vn(r,t,n,o,nn.different):Vn(r,t,n,o,e(r.props,t.props,n,"".concat(o,".props"))?nn.reactElement:nn.different);if(R(r)&&R(t))return r.name===t.name?Vn(r,t,n,o,nn.function):Vn(r,t,n,o,nn.different);if(Mn(r)&&Mn(t)){var c=Oe(r),f=c.length;if(f!==Oe(t).length)return Vn(r,t,n,o,nn.different);for(var s=f;0!=s--;)if(!En(t,c[s]))return Vn(r,t,n,o,nn.different);for(var l=!0,p=f;0!=p--;){var v=c[p];e(r[v],t[v],n,"".concat(o,".").concat(v))||(l=!1)}return Vn(r,t,n,o,l?nn.deepEquals:nn.different)}return Vn(r,t,n,o,nn.different)}(e,r,n,t),n}catch(e){if(e.message&&e.message.match(/stack|recursion/i)||-2146828260===e.number)return console.warn("Warning: why-did-you-render couldn't handle circular references in props.",e.name,e.message),!1;throw e}}var qn={};function Gn(e,r){var o=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).shallow;if(e===r)return!1;if(!(void 0===o||o))return Bn(e,r);var a=e||qn,i=r||qn,u=Object.keys(t({},a,{},i));return On(u,function(e,r){var t=Bn(a[r],i[r],r);return t&&(e=[].concat(n(e),n(t))),e},[])}function Jn(e,r,t,n,o,a){return{propsDifferences:Gn(e,n),stateDifferences:Gn(r,o),hookDifferences:Gn(t,a,{shallow:!1})}}function Kn(e){var r=e.Component,t=e.displayName,n=e.hookName,o=e.prevProps,a=e.prevState,i=e.prevHook,u=e.nextProps,c=e.nextState,f=e.nextHook;return{Component:r,displayName:t,hookName:n,prevProps:o,prevState:a,prevHook:i,nextProps:u,nextState:c,nextHook:f,options:e.options,reason:Jn(o,a,i,u,c,f)}}function Qn(e,r,t){return!function(e,r){return r.exclude&&r.exclude.length>0&&r.exclude.some(function(r){return r.test(e)})}(r,t)&&!(!e.whyDidYouRender&&!function(e,r){return r.include&&r.include.length>0&&r.include.some(function(r){return r.test(e)})}(r,t))}var Xn=function(e,r,t){switch(t.length){case 0:return e.call(r);case 1:return e.call(r,t[0]);case 2:return e.call(r,t[0],t[1]);case 3:return e.call(r,t[0],t[1],t[2])}return e.apply(r,t)},Zn=Math.max;var eo=function(e,r,t){return r=Zn(void 0===r?e.length-1:r,0),function(){for(var n=arguments,o=-1,a=Zn(n.length-r,0),i=Array(a);++o<a;)i[o]=n[r+o];o=-1;for(var u=Array(r+1);++o<r;)u[o]=n[o];return u[r]=t(i),Xn(e,this,u)}};var ro=function(e){return function(){return e}},to=H?function(e,r){return H(e,"toString",{configurable:!0,enumerable:!1,value:ro(r),writable:!0})}:Kt,no=800,oo=16,ao=Date.now;var io=function(e){var r=0,t=0;return function(){var n=ao(),o=oo-(n-t);if(t=n,o>0){if(++r>=no)return arguments[0]}else r=0;return e.apply(void 0,arguments)}}(to);var uo=function(e,r){return io(eo(e,r,Kt),e+"")};var co=function(e,r,t){if(!j(t))return!1;var n=typeof r;return!!("number"==n?je(t)&&oe(r,t.length):"string"==n&&r in t)&&Ee(t[r],e)};var fo=function(e){var r=[];if(null!=e)for(var t in Object(e))r.push(t);return r},so=Object.prototype.hasOwnProperty;var lo=function(e){if(!j(e))return fo(e);var r=ye(e),t=[];for(var n in e)("constructor"!=n||!r&&so.call(e,n))&&t.push(n);return t};var po=function(e){return je(e)?de(e,!0):lo(e)},vo=Object.prototype,ho=vo.hasOwnProperty,yo=uo(function(e,r){e=Object(e);var t=-1,n=r.length,o=n>2?r[2]:void 0;for(o&&co(r[0],r[1],o)&&(n=1);++t<n;)for(var a=r[t],i=po(a),u=-1,c=i.length;++u<c;){var f=i[u],s=e[f];(void 0===s||Ee(s,vo[f])&&!ho.call(e,f))&&(e[f]=a[f])}return e}),bo=2;function _o(e,r,t,n){class o extends e{constructor(r,t){var n;super(r,t),n=this,this._WDYR={renderNumber:0};var a=super.render||this.render;a!==e.prototype.render&&(this.render=function(){return o.prototype.render.apply(n),a()})}render(){return this._WDYR.renderNumber++,"isStrictMode"in this._WDYR||(this._WDYR.isStrictMode=function(e){for(var r=e._reactInternalFiber;r;){if(r.mode&bo)return!0;r=r.return}return!1}(this)),this._WDYR.isStrictMode&&this._WDYR.renderNumber%2==1||(this._WDYR.prevProps&&n.notifier(Kn({Component:e,displayName:r,prevProps:this._WDYR.prevProps,prevState:this._WDYR.prevState,nextProps:this.props,nextState:this.state,options:n})),this._WDYR.prevProps=this.props,this._WDYR.prevState=this.state),super.render?super.render():null}}return o.displayName=r,yo(o,e),o}function go(e,r,t,n,o){var a=r.path,i=t,u=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner.current;if(!u)return i;var c=u.type.ComponentForHooksTracking||u.type,f=_n(c);if(!Qn(c,f,o))return i;var s=n.useRef(),l=s.current;if(s.current=i,l){var p=Kn({Component:c,displayName:f,hookName:e,prevHook:a?It(l,a):l,nextHook:a?It(i,a):i,options:o});p.reason.hookDifferences&&o.notifier(p)}return s.current}function mo(e,r,t,n,o){return r.$$typeof===an?function(e,r,t,n){var o=e.type,a=o.$$typeof===un,i=a?o.render:o;function u(){var o=arguments[0],a=t.useRef(),u=a.current;if(a.current=o,u){var c=Kn({Component:e,displayName:r,prevProps:u,nextProps:o,options:n});c.reason.propsDifferences&&c.reason.propsDifferences.length>0&&n.notifier(c)}return i.apply(void 0,arguments)}u.displayName=_n(i),u.ComponentForHooksTracking=e,yo(u,i);var c=t.memo(a?t.forwardRef(u):u,e.compare);return c.displayName=r,yo(c,e),c}(r,t,n,o):r.$$typeof===un?function(e,r,t,n){var o=e.render,a=o.$$typeof===an,i=a?o.type:o;function u(){var o=arguments[0],a=t.useRef(),u=a.current;if(a.current=o,u){var c=Kn({Component:e,displayName:r,prevProps:u,nextProps:o,options:n});c.reason.propsDifferences&&c.reason.propsDifferences.length>0&&n.notifier(c)}return i.apply(void 0,arguments)}u.displayName=_n(i),u.ComponentForHooksTracking=i,yo(u,i);var c=t.forwardRef(a?t.memo(u,o.compare):u);return c.displayName=r,yo(c,e),c}(r,t,n,o):r.prototype&&r.prototype.isReactComponent?_o(r,t,0,o):function(e,r,t,n){function o(o){var a=t.useRef(),i=a.current;if(a.current=o,i){var u=Kn({Component:e,displayName:r,prevProps:i,nextProps:o,options:n});u.reason.propsDifferences&&n.notifier(u)}return e(o)}return o.displayName=r,o.ComponentForHooksTracking=e,yo(o,e),o}(r,t,n,o)}function jo(e,r,t,n,o){if(e.has(r))return e.get(r);var a=mo(0,r,t,n,o);return e.set(r,a),a}var Oo={useState:{path:"0"},useReducer:{path:"0"},useContext:!0,useMemo:!0};function wo(e,r){var n,o=hn(r),a=e.createElement,i=e.createFactory,u=new WeakMap;if(e.createElement=function(r){for(var t=null,n=null,i=null,c=arguments.length,f=new Array(c>1?c-1:0),s=1;s<c;s++)f[s-1]=arguments[s];try{if(t=("function"==typeof r||r.$$typeof===an||r.$$typeof===un)&&Qn(r,_n(r),o))return n=r&&r.whyDidYouRender&&r.whyDidYouRender.customName||_n(r),i=jo(u,r,n,e,o),a.apply(e,[i].concat(f))}catch(e){o.consoleLog("whyDidYouRender error. Please file a bug at https://github.com/welldone-software/why-did-you-render/issues.",{errorInfo:{error:e,componentNameOrComponent:r,rest:f,options:o,isShouldTrack:t,displayName:n,WDYRPatchedComponent:i}})}return a.apply(e,[r].concat(f))},Object.assign(e.createElement,a),e.createFactory=function(r){var t=e.createElement.bind(null,r);return t.type=r,t},Object.assign(e.createFactory,i),o.trackHooks){var c=tn(Oo,function(r,t){return function(){var a=n[t];if(!a)throw new Error("[WhyDidYouRender] A problem with React Hooks patching occurred.");var i=a.apply(void 0,arguments);return r&&go(t,!0===r?{}:r,i,e,o),i}});Object.defineProperty(e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher,"current",{set:function(e){n=e&&t({},e,{},e.origHooks)},get:function(){return n&&t({},n,{},c,{origHooks:n})}})}return e.__REVERT_WHY_DID_YOU_RENDER__=function(){Object.assign(e,{createElement:a,createFactory:i}),u=null,Object.defineProperty(e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher,"current",{writable:!0,value:n}),delete e.__REVERT_WHY_DID_YOU_RENDER__},e}return wo.defaultNotifier=vn,wo}); | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(e=e||self).whyDidYouRender=r()}(this,function(){"use strict";function e(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function r(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function t(t){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?r(o,!0).forEach(function(r){e(t,r,o[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):r(o).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))})}return t}function n(e){return function(e){if(Array.isArray(e)){for(var r=0,t=new Array(e.length);r<e.length;r++)t[r]=e[r];return t}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function a(e,r){return e(r={exports:{}},r.exports),r.exports}var i="object"==typeof o&&o&&o.Object===Object&&o,u="object"==typeof self&&self&&self.Object===Object&&self,c=i||u||Function("return this")(),f=c.Symbol,s=Object.prototype,l=s.hasOwnProperty,p=s.toString,v=f?f.toStringTag:void 0;var d=function(e){var r=l.call(e,v),t=e[v];try{e[v]=void 0;var n=!0}catch(e){}var o=p.call(e);return n&&(r?e[v]=t:delete e[v]),o},h=Object.prototype.toString;var y=function(e){return h.call(e)},b="[object Null]",_="[object Undefined]",g=f?f.toStringTag:void 0;var m=function(e){return null==e?void 0===e?_:b:g&&g in Object(e)?d(e):y(e)};var j=function(e){var r=typeof e;return null!=e&&("object"==r||"function"==r)},O="[object AsyncFunction]",w="[object Function]",D="[object GeneratorFunction]",E="[object Proxy]";var S,R=function(e){if(!j(e))return!1;var r=m(e);return r==w||r==D||r==O||r==E},k=c["__core-js_shared__"],x=(S=/[^.]+$/.exec(k&&k.keys&&k.keys.IE_PROTO||""))?"Symbol(src)_1."+S:"";var P=function(e){return!!x&&x in e},N=Function.prototype.toString;var T=function(e){if(null!=e){try{return N.call(e)}catch(e){}try{return e+""}catch(e){}}return""},A=/^\[object .+?Constructor\]$/,C=Function.prototype,Y=Object.prototype,z=C.toString,L=Y.hasOwnProperty,W=RegExp("^"+z.call(L).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var $=function(e){return!(!j(e)||P(e))&&(R(e)?W:A).test(T(e))};var F=function(e,r){return null==e?void 0:e[r]};var M=function(e,r){var t=F(e,r);return $(t)?t:void 0},H=function(){try{var e=M(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var I=function(e,r,t){"__proto__"==r&&H?H(e,r,{configurable:!0,enumerable:!0,value:t,writable:!0}):e[r]=t};var U=function(e){return function(r,t,n){for(var o=-1,a=Object(r),i=n(r),u=i.length;u--;){var c=i[e?u:++o];if(!1===t(a[c],c,a))break}return r}}();var V=function(e,r){for(var t=-1,n=Array(e);++t<e;)n[t]=r(t);return n};var B=function(e){return null!=e&&"object"==typeof e},q="[object Arguments]";var G=function(e){return B(e)&&m(e)==q},J=Object.prototype,K=J.hasOwnProperty,Q=J.propertyIsEnumerable,X=G(function(){return arguments}())?G:function(e){return B(e)&&K.call(e,"callee")&&!Q.call(e,"callee")},Z=Array.isArray;var ee=function(){return!1},re=a(function(e,r){var t=r&&!r.nodeType&&r,n=t&&e&&!e.nodeType&&e,o=n&&n.exports===t?c.Buffer:void 0,a=(o?o.isBuffer:void 0)||ee;e.exports=a}),te=9007199254740991,ne=/^(?:0|[1-9]\d*)$/;var oe=function(e,r){var t=typeof e;return!!(r=null==r?te:r)&&("number"==t||"symbol"!=t&&ne.test(e))&&e>-1&&e%1==0&&e<r},ae=9007199254740991;var ie=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=ae},ue={};ue["[object Float32Array]"]=ue["[object Float64Array]"]=ue["[object Int8Array]"]=ue["[object Int16Array]"]=ue["[object Int32Array]"]=ue["[object Uint8Array]"]=ue["[object Uint8ClampedArray]"]=ue["[object Uint16Array]"]=ue["[object Uint32Array]"]=!0,ue["[object Arguments]"]=ue["[object Array]"]=ue["[object ArrayBuffer]"]=ue["[object Boolean]"]=ue["[object DataView]"]=ue["[object Date]"]=ue["[object Error]"]=ue["[object Function]"]=ue["[object Map]"]=ue["[object Number]"]=ue["[object Object]"]=ue["[object RegExp]"]=ue["[object Set]"]=ue["[object String]"]=ue["[object WeakMap]"]=!1;var ce=function(e){return B(e)&&ie(e.length)&&!!ue[m(e)]};var fe=function(e){return function(r){return e(r)}},se=a(function(e,r){var t=r&&!r.nodeType&&r,n=t&&e&&!e.nodeType&&e,o=n&&n.exports===t&&i.process,a=function(){try{var e=n&&n.require&&n.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=a}),le=se&&se.isTypedArray,pe=le?fe(le):ce,ve=Object.prototype.hasOwnProperty;var de=function(e,r){var t=Z(e),n=!t&&X(e),o=!t&&!n&&re(e),a=!t&&!n&&!o&&pe(e),i=t||n||o||a,u=i?V(e.length,String):[],c=u.length;for(var f in e)!r&&!ve.call(e,f)||i&&("length"==f||o&&("offset"==f||"parent"==f)||a&&("buffer"==f||"byteLength"==f||"byteOffset"==f)||oe(f,c))||u.push(f);return u},he=Object.prototype;var ye=function(e){var r=e&&e.constructor;return e===("function"==typeof r&&r.prototype||he)};var be=function(e,r){return function(t){return e(r(t))}},_e=be(Object.keys,Object),ge=Object.prototype.hasOwnProperty;var me=function(e){if(!ye(e))return _e(e);var r=[];for(var t in Object(e))ge.call(e,t)&&"constructor"!=t&&r.push(t);return r};var je=function(e){return null!=e&&ie(e.length)&&!R(e)};var Oe=function(e){return je(e)?de(e):me(e)};var we=function(e,r){return e&&U(e,r,Oe)};var De=function(){this.__data__=[],this.size=0};var Ee=function(e,r){return e===r||e!=e&&r!=r};var Se=function(e,r){for(var t=e.length;t--;)if(Ee(e[t][0],r))return t;return-1},Re=Array.prototype.splice;var ke=function(e){var r=this.__data__,t=Se(r,e);return!(t<0||(t==r.length-1?r.pop():Re.call(r,t,1),--this.size,0))};var xe=function(e){var r=this.__data__,t=Se(r,e);return t<0?void 0:r[t][1]};var Pe=function(e){return Se(this.__data__,e)>-1};var Ne=function(e,r){var t=this.__data__,n=Se(t,e);return n<0?(++this.size,t.push([e,r])):t[n][1]=r,this};function Te(e){var r=-1,t=null==e?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}Te.prototype.clear=De,Te.prototype.delete=ke,Te.prototype.get=xe,Te.prototype.has=Pe,Te.prototype.set=Ne;var Ae=Te;var Ce=function(){this.__data__=new Ae,this.size=0};var Ye=function(e){var r=this.__data__,t=r.delete(e);return this.size=r.size,t};var ze=function(e){return this.__data__.get(e)};var Le=function(e){return this.__data__.has(e)},We=M(c,"Map"),$e=M(Object,"create");var Fe=function(){this.__data__=$e?$e(null):{},this.size=0};var Me=function(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r},He="__lodash_hash_undefined__",Ie=Object.prototype.hasOwnProperty;var Ue=function(e){var r=this.__data__;if($e){var t=r[e];return t===He?void 0:t}return Ie.call(r,e)?r[e]:void 0},Ve=Object.prototype.hasOwnProperty;var Be=function(e){var r=this.__data__;return $e?void 0!==r[e]:Ve.call(r,e)},qe="__lodash_hash_undefined__";var Ge=function(e,r){var t=this.__data__;return this.size+=this.has(e)?0:1,t[e]=$e&&void 0===r?qe:r,this};function Je(e){var r=-1,t=null==e?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}Je.prototype.clear=Fe,Je.prototype.delete=Me,Je.prototype.get=Ue,Je.prototype.has=Be,Je.prototype.set=Ge;var Ke=Je;var Qe=function(){this.size=0,this.__data__={hash:new Ke,map:new(We||Ae),string:new Ke}};var Xe=function(e){var r=typeof e;return"string"==r||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==e:null===e};var Ze=function(e,r){var t=e.__data__;return Xe(r)?t["string"==typeof r?"string":"hash"]:t.map};var er=function(e){var r=Ze(this,e).delete(e);return this.size-=r?1:0,r};var rr=function(e){return Ze(this,e).get(e)};var tr=function(e){return Ze(this,e).has(e)};var nr=function(e,r){var t=Ze(this,e),n=t.size;return t.set(e,r),this.size+=t.size==n?0:1,this};function or(e){var r=-1,t=null==e?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}or.prototype.clear=Qe,or.prototype.delete=er,or.prototype.get=rr,or.prototype.has=tr,or.prototype.set=nr;var ar=or,ir=200;var ur=function(e,r){var t=this.__data__;if(t instanceof Ae){var n=t.__data__;if(!We||n.length<ir-1)return n.push([e,r]),this.size=++t.size,this;t=this.__data__=new ar(n)}return t.set(e,r),this.size=t.size,this};function cr(e){var r=this.__data__=new Ae(e);this.size=r.size}cr.prototype.clear=Ce,cr.prototype.delete=Ye,cr.prototype.get=ze,cr.prototype.has=Le,cr.prototype.set=ur;var fr=cr,sr="__lodash_hash_undefined__";var lr=function(e){return this.__data__.set(e,sr),this};var pr=function(e){return this.__data__.has(e)};function vr(e){var r=-1,t=null==e?0:e.length;for(this.__data__=new ar;++r<t;)this.add(e[r])}vr.prototype.add=vr.prototype.push=lr,vr.prototype.has=pr;var dr=vr;var hr=function(e,r){for(var t=-1,n=null==e?0:e.length;++t<n;)if(r(e[t],t,e))return!0;return!1};var yr=function(e,r){return e.has(r)},br=1,_r=2;var gr=function(e,r,t,n,o,a){var i=t&br,u=e.length,c=r.length;if(u!=c&&!(i&&c>u))return!1;var f=a.get(e);if(f&&a.get(r))return f==r;var s=-1,l=!0,p=t&_r?new dr:void 0;for(a.set(e,r),a.set(r,e);++s<u;){var v=e[s],d=r[s];if(n)var h=i?n(d,v,s,r,e,a):n(v,d,s,e,r,a);if(void 0!==h){if(h)continue;l=!1;break}if(p){if(!hr(r,function(e,r){if(!yr(p,r)&&(v===e||o(v,e,t,n,a)))return p.push(r)})){l=!1;break}}else if(v!==d&&!o(v,d,t,n,a)){l=!1;break}}return a.delete(e),a.delete(r),l},mr=c.Uint8Array;var jr=function(e){var r=-1,t=Array(e.size);return e.forEach(function(e,n){t[++r]=[n,e]}),t};var Or=function(e){var r=-1,t=Array(e.size);return e.forEach(function(e){t[++r]=e}),t},wr=1,Dr=2,Er="[object Boolean]",Sr="[object Date]",Rr="[object Error]",kr="[object Map]",xr="[object Number]",Pr="[object RegExp]",Nr="[object Set]",Tr="[object String]",Ar="[object Symbol]",Cr="[object ArrayBuffer]",Yr="[object DataView]",zr=f?f.prototype:void 0,Lr=zr?zr.valueOf:void 0;var Wr=function(e,r,t,n,o,a,i){switch(t){case Yr:if(e.byteLength!=r.byteLength||e.byteOffset!=r.byteOffset)return!1;e=e.buffer,r=r.buffer;case Cr:return!(e.byteLength!=r.byteLength||!a(new mr(e),new mr(r)));case Er:case Sr:case xr:return Ee(+e,+r);case Rr:return e.name==r.name&&e.message==r.message;case Pr:case Tr:return e==r+"";case kr:var u=jr;case Nr:var c=n≀if(u||(u=Or),e.size!=r.size&&!c)return!1;var f=i.get(e);if(f)return f==r;n|=Dr,i.set(e,r);var s=gr(u(e),u(r),n,o,a,i);return i.delete(e),s;case Ar:if(Lr)return Lr.call(e)==Lr.call(r)}return!1};var $r=function(e,r){for(var t=-1,n=r.length,o=e.length;++t<n;)e[o+t]=r[t];return e};var Fr=function(e,r,t){var n=r(e);return Z(e)?n:$r(n,t(e))};var Mr=function(e,r){for(var t=-1,n=null==e?0:e.length,o=0,a=[];++t<n;){var i=e[t];r(i,t,e)&&(a[o++]=i)}return a};var Hr=function(){return[]},Ir=Object.prototype.propertyIsEnumerable,Ur=Object.getOwnPropertySymbols,Vr=Ur?function(e){return null==e?[]:(e=Object(e),Mr(Ur(e),function(r){return Ir.call(e,r)}))}:Hr;var Br=function(e){return Fr(e,Oe,Vr)},qr=1,Gr=Object.prototype.hasOwnProperty;var Jr=function(e,r,t,n,o,a){var i=t&qr,u=Br(e),c=u.length;if(c!=Br(r).length&&!i)return!1;for(var f=c;f--;){var s=u[f];if(!(i?s in r:Gr.call(r,s)))return!1}var l=a.get(e);if(l&&a.get(r))return l==r;var p=!0;a.set(e,r),a.set(r,e);for(var v=i;++f<c;){var d=e[s=u[f]],h=r[s];if(n)var y=i?n(h,d,s,r,e,a):n(d,h,s,e,r,a);if(!(void 0===y?d===h||o(d,h,t,n,a):y)){p=!1;break}v||(v="constructor"==s)}if(p&&!v){var b=e.constructor,_=r.constructor;b!=_&&"constructor"in e&&"constructor"in r&&!("function"==typeof b&&b instanceof b&&"function"==typeof _&&_ instanceof _)&&(p=!1)}return a.delete(e),a.delete(r),p},Kr=M(c,"DataView"),Qr=M(c,"Promise"),Xr=M(c,"Set"),Zr=M(c,"WeakMap"),et=T(Kr),rt=T(We),tt=T(Qr),nt=T(Xr),ot=T(Zr),at=m;(Kr&&"[object DataView]"!=at(new Kr(new ArrayBuffer(1)))||We&&"[object Map]"!=at(new We)||Qr&&"[object Promise]"!=at(Qr.resolve())||Xr&&"[object Set]"!=at(new Xr)||Zr&&"[object WeakMap]"!=at(new Zr))&&(at=function(e){var r=m(e),t="[object Object]"==r?e.constructor:void 0,n=t?T(t):"";if(n)switch(n){case et:return"[object DataView]";case rt:return"[object Map]";case tt:return"[object Promise]";case nt:return"[object Set]";case ot:return"[object WeakMap]"}return r});var it=at,ut=1,ct="[object Arguments]",ft="[object Array]",st="[object Object]",lt=Object.prototype.hasOwnProperty;var pt=function(e,r,t,n,o,a){var i=Z(e),u=Z(r),c=i?ft:it(e),f=u?ft:it(r),s=(c=c==ct?st:c)==st,l=(f=f==ct?st:f)==st,p=c==f;if(p&&re(e)){if(!re(r))return!1;i=!0,s=!1}if(p&&!s)return a||(a=new fr),i||pe(e)?gr(e,r,t,n,o,a):Wr(e,r,c,t,n,o,a);if(!(t&ut)){var v=s&<.call(e,"__wrapped__"),d=l&<.call(r,"__wrapped__");if(v||d){var h=v?e.value():e,y=d?r.value():r;return a||(a=new fr),o(h,y,t,n,a)}}return!!p&&(a||(a=new fr),Jr(e,r,t,n,o,a))};var vt=function e(r,t,n,o,a){return r===t||(null==r||null==t||!B(r)&&!B(t)?r!=r&&t!=t:pt(r,t,n,o,e,a))},dt=1,ht=2;var yt=function(e,r,t,n){var o=t.length,a=o,i=!n;if(null==e)return!a;for(e=Object(e);o--;){var u=t[o];if(i&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++o<a;){var c=(u=t[o])[0],f=e[c],s=u[1];if(i&&u[2]){if(void 0===f&&!(c in e))return!1}else{var l=new fr;if(n)var p=n(f,s,c,e,r,l);if(!(void 0===p?vt(s,f,dt|ht,n,l):p))return!1}}return!0};var bt=function(e){return e==e&&!j(e)};var _t=function(e){for(var r=Oe(e),t=r.length;t--;){var n=r[t],o=e[n];r[t]=[n,o,bt(o)]}return r};var gt=function(e,r){return function(t){return null!=t&&t[e]===r&&(void 0!==r||e in Object(t))}};var mt=function(e){var r=_t(e);return 1==r.length&&r[0][2]?gt(r[0][0],r[0][1]):function(t){return t===e||yt(t,e,r)}},jt="[object Symbol]";var Ot=function(e){return"symbol"==typeof e||B(e)&&m(e)==jt},wt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Dt=/^\w*$/;var Et=function(e,r){if(Z(e))return!1;var t=typeof e;return!("number"!=t&&"symbol"!=t&&"boolean"!=t&&null!=e&&!Ot(e))||Dt.test(e)||!wt.test(e)||null!=r&&e in Object(r)},St="Expected a function";function Rt(e,r){if("function"!=typeof e||null!=r&&"function"!=typeof r)throw new TypeError(St);var t=function(){var n=arguments,o=r?r.apply(this,n):n[0],a=t.cache;if(a.has(o))return a.get(o);var i=e.apply(this,n);return t.cache=a.set(o,i)||a,i};return t.cache=new(Rt.Cache||ar),t}Rt.Cache=ar;var kt=Rt,xt=500;var Pt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Nt=/\\(\\)?/g,Tt=function(e){var r=kt(e,function(e){return t.size===xt&&t.clear(),e}),t=r.cache;return r}(function(e){var r=[];return 46===e.charCodeAt(0)&&r.push(""),e.replace(Pt,function(e,t,n,o){r.push(n?o.replace(Nt,"$1"):t||e)}),r});var At=function(e,r){for(var t=-1,n=null==e?0:e.length,o=Array(n);++t<n;)o[t]=r(e[t],t,e);return o},Ct=1/0,Yt=f?f.prototype:void 0,zt=Yt?Yt.toString:void 0;var Lt=function e(r){if("string"==typeof r)return r;if(Z(r))return At(r,e)+"";if(Ot(r))return zt?zt.call(r):"";var t=r+"";return"0"==t&&1/r==-Ct?"-0":t};var Wt=function(e){return null==e?"":Lt(e)};var $t=function(e,r){return Z(e)?e:Et(e,r)?[e]:Tt(Wt(e))},Ft=1/0;var Mt=function(e){if("string"==typeof e||Ot(e))return e;var r=e+"";return"0"==r&&1/e==-Ft?"-0":r};var Ht=function(e,r){for(var t=0,n=(r=$t(r,e)).length;null!=e&&t<n;)e=e[Mt(r[t++])];return t&&t==n?e:void 0};var It=function(e,r,t){var n=null==e?void 0:Ht(e,r);return void 0===n?t:n};var Ut=function(e,r){return null!=e&&r in Object(e)};var Vt=function(e,r,t){for(var n=-1,o=(r=$t(r,e)).length,a=!1;++n<o;){var i=Mt(r[n]);if(!(a=null!=e&&t(e,i)))break;e=e[i]}return a||++n!=o?a:!!(o=null==e?0:e.length)&&ie(o)&&oe(i,o)&&(Z(e)||X(e))};var Bt=function(e,r){return null!=e&&Vt(e,r,Ut)},qt=1,Gt=2;var Jt=function(e,r){return Et(e)&&bt(r)?gt(Mt(e),r):function(t){var n=It(t,e);return void 0===n&&n===r?Bt(t,e):vt(r,n,qt|Gt)}};var Kt=function(e){return e};var Qt=function(e){return function(r){return null==r?void 0:r[e]}};var Xt=function(e){return function(r){return Ht(r,e)}};var Zt=function(e){return Et(e)?Qt(Mt(e)):Xt(e)};var en=function(e){return"function"==typeof e?e:null==e?Kt:"object"==typeof e?Z(e)?Jt(e[0],e[1]):mt(e):Zt(e)};var rn,tn=function(e,r){var t={};return r=en(r),we(e,function(e,n,o){I(t,n,r(e,n,o))}),t},nn={different:"different",deepEquals:"deepEquals",date:"date",regex:"regex",reactElement:"reactElement",function:"function"},on="function"==typeof Symbol&&Symbol.for,an=on?Symbol.for("react.memo"):60115,un=on?Symbol.for("react.forward_ref"):60112,cn="http://bit.ly/wdyr02",fn="http://bit.ly/wdyr3",sn=(e(rn={},nn.different,"different objects."),e(rn,nn.deepEquals,"different objects that are equal by value."),e(rn,nn.date,"different date objects with the same value."),e(rn,nn.regex,"different regular expressions with the same value."),e(rn,nn.reactElement,"different React elements with the same displayName."),e(rn,nn.function,"different functions with the same name."),rn),ln=!1;function pn(r){var t=r.Component,n=r.displayName,o=r.hookName,a=r.prefixMessage,i=r.diffObjType,u=r.differences,c=r.values,f=r.options;u&&u.length>0?(f.consoleLog(e({},n,t),"".concat(a," of ").concat(i," changes:")),u.forEach(function(r){var t=r.pathString,n=r.diffType,a=r.prevValue,u=r.nextValue;f.consoleGroup("%c".concat("hook"===i?"[hook ".concat(o," result]"):"".concat(i,"."),"%c").concat(t,"%c"),"color:".concat(f.diffNameColor,";"),"color:".concat(f.diffPathColor,";"),"color:default;"),f.consoleLog("".concat(sn[n]," (more info at ").concat(o?fn:cn,")")),f.consoleLog(e({},"prev ".concat(t),a),"!==",e({},"next ".concat(t),u)),f.consoleGroupEnd()})):u&&(f.consoleLog(e({},n,t),"".concat(a," the ").concat(i," object itself changed but its values are all equal."),"props"===i?"This could have been avoided by making the component pure, or by preventing its father from re-rendering.":"This usually means this component called setState when no changes in its state actually occurred.","More info at ".concat(cn)),f.consoleLog("prev ".concat(i,":"),c.prev," !== ",c.next,":next ".concat(i)))}function vn(r){var t=r.Component,n=r.displayName,o=r.hookName,a=r.prevProps,i=r.prevState,u=r.prevHook,c=r.nextProps,f=r.nextState,s=r.nextHook,l=r.reason,p=r.options;if(function(e,r,t){return!(ln||!t.logOnDifferentValues&&(!r.whyDidYouRender||!r.whyDidYouRender.logOnDifferentValues)&&(e.propsDifferences&&e.propsDifferences.some(function(e){return e.diffType===nn.different})||e.stateDifferences&&e.stateDifferences.some(function(e){return e.diffType===nn.different})||e.hookDifferences&&e.hookDifferences.some(function(e){return e.diffType===nn.different})))}(l,t,p)){p.consoleGroup("%c".concat(n),"color: ".concat(p.titleColor,";"));var v="Re-rendered because";l.propsDifferences&&(pn({Component:t,displayName:n,prefixMessage:v,diffObjType:"props",differences:l.propsDifferences,values:{prev:a,next:c},options:p}),v="And because"),l.stateDifferences&&pn({Component:t,displayName:n,prefixMessage:v,diffObjType:"state",differences:l.stateDifferences,values:{prev:i,next:f},options:p}),l.hookDifferences&&pn({Component:t,displayName:n,prefixMessage:v,diffObjType:"hook",differences:l.hookDifferences,values:{prev:u,next:s},hookName:o,options:p}),l.propsDifferences||l.stateDifferences||l.hookDifferences||p.consoleLog(e({},n,t),"Re-rendered although props and state objects are the same.","This usually means there was a call to this.forceUpdate() inside the component.","more info at ".concat(cn)),p.consoleGroupEnd()}}var dn=function(){};function hn(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=console.group,o=console.groupEnd;return r.collapseGroups?n=console.groupCollapsed:r.onlyLogs&&(n=console.log,o=dn),t({include:null,exclude:null,notifier:r.notifier||((e="hotReloadBufferMs"in r?r.hotReloadBufferMs:500)&&module&&module.hot&&module.hot.addStatusHandler&&module.hot.addStatusHandler(function(r){"idle"===r&&(ln=!0,setTimeout(function(){ln=!1},e))}),vn),onlyLogs:!1,consoleLog:console.log,consoleGroup:n,consoleGroupEnd:o,logOnDifferentValues:!1,trackHooks:!0,titleColor:"#058",diffNameColor:"blue",diffPathColor:"red"},r)}var yn="[object String]";var bn=function(e){return"string"==typeof e||!Z(e)&&B(e)&&m(e)==yn};function _n(e){return e.displayName||e.name||e.type&&_n(e.type)||e.render&&_n(e.render)||(bn(e)?e:void 0)}var gn=function(e,r,t,n){var o=-1,a=null==e?0:e.length;for(n&&a&&(t=e[++o]);++o<a;)t=r(t,e[o],o,e);return t};var mn=function(e,r){return function(t,n){if(null==t)return t;if(!je(t))return e(t,n);for(var o=t.length,a=r?o:-1,i=Object(t);(r?a--:++a<o)&&!1!==n(i[a],a,i););return t}}(we);var jn=function(e,r,t,n,o){return o(e,function(e,o,a){t=n?(n=!1,e):r(t,e,o,a)}),t};var On=function(e,r,t){var n=Z(e)?gn:jn,o=arguments.length<3;return n(e,en(r),t,o,mn)},wn=Object.prototype.hasOwnProperty;var Dn=function(e,r){return null!=e&&wn.call(e,r)};var En=function(e,r){return null!=e&&Vt(e,r,Dn)},Sn="[object RegExp]";var Rn=function(e){return B(e)&&m(e)==Sn},kn=se&&se.isRegExp,xn=kn?fe(kn):Rn,Pn="[object Date]";var Nn=function(e){return B(e)&&m(e)==Pn},Tn=se&&se.isDate,An=Tn?fe(Tn):Nn,Cn=be(Object.getPrototypeOf,Object),Yn="[object Object]",zn=Function.prototype,Ln=Object.prototype,Wn=zn.toString,$n=Ln.hasOwnProperty,Fn=Wn.call(Object);var Mn=function(e){if(!B(e)||m(e)!=Yn)return!1;var r=Cn(e);if(null===r)return!0;var t=$n.call(r,"constructor")&&r.constructor;return"function"==typeof t&&t instanceof t&&Wn.call(t)==Fn},Hn="undefined"!=typeof Element,In="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103,Un=function(e){return e.$$typeof===In};function Vn(e,r,t,n,o){return t.push({diffType:o,pathString:n,prevValue:e,nextValue:r}),o!==nn.different}function Bn(e,r,t){try{var n=[];return function e(r,t,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";if(r===t)return!0;if(!r||!t)return Vn(r,t,n,o,nn.different);if(Z(r)&&Z(t)){var a=r.length;if(a!==t.length)return Vn(r,t,n,o,nn.different);for(var i=!0,u=a;0!=u--;)e(r[u],t[u],n,"".concat(o,"[").concat(u,"]"))||(i=!1);return Vn(r,t,n,o,i?nn.deepEquals:nn.different)}if(An(r)&&An(t))return r.getTime()===t.getTime()?Vn(r,t,n,o,nn.date):Vn(r,t,n,o,nn.different);if(xn(r)&&xn(t))return r.toString()===t.toString()?Vn(r,t,n,o,nn.regex):Vn(r,t,n,o,nn.different);if(Hn&&r instanceof Element&&t instanceof Element)return Vn(r,t,n,o,nn.different);if(Un(r)&&Un(t))return r.type!==t.type?Vn(r,t,n,o,nn.different):Vn(r,t,n,o,e(r.props,t.props,n,"".concat(o,".props"))?nn.reactElement:nn.different);if(R(r)&&R(t))return r.name===t.name?Vn(r,t,n,o,nn.function):Vn(r,t,n,o,nn.different);if(Mn(r)&&Mn(t)){var c=Oe(r),f=c.length;if(f!==Oe(t).length)return Vn(r,t,n,o,nn.different);for(var s=f;0!=s--;)if(!En(t,c[s]))return Vn(r,t,n,o,nn.different);for(var l=!0,p=f;0!=p--;){var v=c[p];e(r[v],t[v],n,"".concat(o,".").concat(v))||(l=!1)}return Vn(r,t,n,o,l?nn.deepEquals:nn.different)}return Vn(r,t,n,o,nn.different)}(e,r,n,t),n}catch(e){if(e.message&&e.message.match(/stack|recursion/i)||-2146828260===e.number)return console.warn("Warning: why-did-you-render couldn't handle circular references in props.",e.name,e.message),!1;throw e}}var qn={};function Gn(e,r){var o=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).shallow;if(e===r)return!1;if(!(void 0===o||o))return Bn(e,r);var a=e||qn,i=r||qn,u=Object.keys(t({},a,{},i));return On(u,function(e,r){var t=Bn(a[r],i[r],r);return t&&(e=[].concat(n(e),n(t))),e},[])}function Jn(e,r,t,n,o,a){return{propsDifferences:Gn(e,n),stateDifferences:Gn(r,o),hookDifferences:Gn(t,a,{shallow:!1})}}function Kn(e){var r=e.Component,t=e.displayName,n=e.hookName,o=e.prevProps,a=e.prevState,i=e.prevHook,u=e.nextProps,c=e.nextState,f=e.nextHook;return{Component:r,displayName:t,hookName:n,prevProps:o,prevState:a,prevHook:i,nextProps:u,nextState:c,nextHook:f,options:e.options,reason:Jn(o,a,i,u,c,f)}}function Qn(e,r,t){return!function(e,r){return r.exclude&&r.exclude.length>0&&r.exclude.some(function(r){return r.test(e)})}(r,t)&&!(!e.whyDidYouRender&&!function(e,r){return r.include&&r.include.length>0&&r.include.some(function(r){return r.test(e)})}(r,t))}var Xn=function(e,r,t){switch(t.length){case 0:return e.call(r);case 1:return e.call(r,t[0]);case 2:return e.call(r,t[0],t[1]);case 3:return e.call(r,t[0],t[1],t[2])}return e.apply(r,t)},Zn=Math.max;var eo=function(e,r,t){return r=Zn(void 0===r?e.length-1:r,0),function(){for(var n=arguments,o=-1,a=Zn(n.length-r,0),i=Array(a);++o<a;)i[o]=n[r+o];o=-1;for(var u=Array(r+1);++o<r;)u[o]=n[o];return u[r]=t(i),Xn(e,this,u)}};var ro=function(e){return function(){return e}},to=H?function(e,r){return H(e,"toString",{configurable:!0,enumerable:!1,value:ro(r),writable:!0})}:Kt,no=800,oo=16,ao=Date.now;var io=function(e){var r=0,t=0;return function(){var n=ao(),o=oo-(n-t);if(t=n,o>0){if(++r>=no)return arguments[0]}else r=0;return e.apply(void 0,arguments)}}(to);var uo=function(e,r){return io(eo(e,r,Kt),e+"")};var co=function(e,r,t){if(!j(t))return!1;var n=typeof r;return!!("number"==n?je(t)&&oe(r,t.length):"string"==n&&r in t)&&Ee(t[r],e)};var fo=function(e){var r=[];if(null!=e)for(var t in Object(e))r.push(t);return r},so=Object.prototype.hasOwnProperty;var lo=function(e){if(!j(e))return fo(e);var r=ye(e),t=[];for(var n in e)("constructor"!=n||!r&&so.call(e,n))&&t.push(n);return t};var po=function(e){return je(e)?de(e,!0):lo(e)},vo=Object.prototype,ho=vo.hasOwnProperty,yo=uo(function(e,r){e=Object(e);var t=-1,n=r.length,o=n>2?r[2]:void 0;for(o&&co(r[0],r[1],o)&&(n=1);++t<n;)for(var a=r[t],i=po(a),u=-1,c=i.length;++u<c;){var f=i[u],s=e[f];(void 0===s||Ee(s,vo[f])&&!ho.call(e,f))&&(e[f]=a[f])}return e}),bo=1;function _o(e,r,t,n){class o extends e{constructor(r,t){var n;super(r,t),n=this,this._WDYR={renderNumber:0};var a=super.render||this.render;a!==e.prototype.render&&(this.render=function(){return o.prototype.render.apply(n),a()})}render(){return this._WDYR.renderNumber++,"isStrictMode"in this._WDYR||(this._WDYR.isStrictMode=function(e){for(var r=e._reactInternalFiber;null!==r;){if(r.mode&bo)return!0;r=r.return}return!1}(this)),this._WDYR.isStrictMode&&this._WDYR.renderNumber%2==1||(this._WDYR.prevProps&&n.notifier(Kn({Component:e,displayName:r,prevProps:this._WDYR.prevProps,prevState:this._WDYR.prevState,nextProps:this.props,nextState:this.state,options:n})),this._WDYR.prevProps=this.props,this._WDYR.prevState=this.state),super.render?super.render():null}}return o.displayName=r,yo(o,e),o}function go(e,r,t,n,o){var a=r.path,i=t,u=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner.current;if(!u)return i;var c=u.type.ComponentForHooksTracking||u.type,f=_n(c);if(!Qn(c,f,o))return i;var s=n.useRef(),l=s.current;if(s.current=i,l){var p=Kn({Component:c,displayName:f,hookName:e,prevHook:a?It(l,a):l,nextHook:a?It(i,a):i,options:o});p.reason.hookDifferences&&o.notifier(p)}return s.current}function mo(e,r,t,n,o){return r.$$typeof===an?function(e,r,t,n){var o=e.type,a=o.$$typeof===un,i=a?o.render:o;function u(){var o=arguments[0],a=t.useRef(),u=a.current;if(a.current=o,u){var c=Kn({Component:e,displayName:r,prevProps:u,nextProps:o,options:n});c.reason.propsDifferences&&c.reason.propsDifferences.length>0&&n.notifier(c)}return i.apply(void 0,arguments)}u.displayName=_n(i),u.ComponentForHooksTracking=e,yo(u,i);var c=t.memo(a?t.forwardRef(u):u,e.compare);return c.displayName=r,yo(c,e),c}(r,t,n,o):r.$$typeof===un?function(e,r,t,n){var o=e.render,a=o.$$typeof===an,i=a?o.type:o;function u(){var o=arguments[0],a=t.useRef(),u=a.current;if(a.current=o,u){var c=Kn({Component:e,displayName:r,prevProps:u,nextProps:o,options:n});c.reason.propsDifferences&&c.reason.propsDifferences.length>0&&n.notifier(c)}return i.apply(void 0,arguments)}u.displayName=_n(i),u.ComponentForHooksTracking=i,yo(u,i);var c=t.forwardRef(a?t.memo(u,o.compare):u);return c.displayName=r,yo(c,e),c}(r,t,n,o):r.prototype&&r.prototype.isReactComponent?_o(r,t,0,o):function(e,r,t,n){function o(o){var a=t.useRef(),i=a.current;if(a.current=o,i){var u=Kn({Component:e,displayName:r,prevProps:i,nextProps:o,options:n});u.reason.propsDifferences&&n.notifier(u)}return e(o)}return o.displayName=r,o.ComponentForHooksTracking=e,yo(o,e),o}(r,t,n,o)}function jo(e,r,t,n,o){if(e.has(r))return e.get(r);var a=mo(0,r,t,n,o);return e.set(r,a),a}var Oo={useState:{path:"0"},useReducer:{path:"0"},useContext:!0,useMemo:!0};function wo(e,r){var n,o=hn(r),a=e.createElement,i=e.createFactory,u=new WeakMap;if(e.createElement=function(r){for(var t=null,n=null,i=null,c=arguments.length,f=new Array(c>1?c-1:0),s=1;s<c;s++)f[s-1]=arguments[s];try{if(t=("function"==typeof r||r.$$typeof===an||r.$$typeof===un)&&Qn(r,_n(r),o))return n=r&&r.whyDidYouRender&&r.whyDidYouRender.customName||_n(r),i=jo(u,r,n,e,o),a.apply(e,[i].concat(f))}catch(e){o.consoleLog("whyDidYouRender error. Please file a bug at https://github.com/welldone-software/why-did-you-render/issues.",{errorInfo:{error:e,componentNameOrComponent:r,rest:f,options:o,isShouldTrack:t,displayName:n,WDYRPatchedComponent:i}})}return a.apply(e,[r].concat(f))},Object.assign(e.createElement,a),e.createFactory=function(r){var t=e.createElement.bind(null,r);return t.type=r,t},Object.assign(e.createFactory,i),o.trackHooks){var c=tn(Oo,function(r,t){return function(){var a=n[t];if(!a)throw new Error("[WhyDidYouRender] A problem with React Hooks patching occurred.");var i=a.apply(void 0,arguments);return r&&go(t,!0===r?{}:r,i,e,o),i}});Object.defineProperty(e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher,"current",{set:function(e){n=e&&t({},e,{},e.origHooks)},get:function(){return n&&t({},n,{},c,{origHooks:n})}})}return e.__REVERT_WHY_DID_YOU_RENDER__=function(){Object.assign(e,{createElement:a,createFactory:i}),u=null,Object.defineProperty(e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher,"current",{writable:!0,value:n}),delete e.__REVERT_WHY_DID_YOU_RENDER__},e}return wo.defaultNotifier=vn,wo}); | ||
//# sourceMappingURL=whyDidYouRender.min.js.map |
/** | ||
* @welldone-software/why-did-you-render 3.3.2 | ||
* @welldone-software/why-did-you-render 3.3.3 | ||
* MIT Licensed | ||
* Generated by Vitali Zaidman <vzaidman@gmail.com> (https://github.com/vzaidman) | ||
* Generated at 2019-08-09 | ||
* Generated at 2019-08-13 | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).whyDidYouRender=t()}(this,function(){"use strict";function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function t(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function r(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function n(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?r(o,!0).forEach(function(r){t(e,r,o[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):r(o).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function u(e,t,r){return(u="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=o(e)););return e}(e,t);if(n){var a=Object.getOwnPropertyDescriptor(n,t);return a.get?a.get.call(r):a.value}})(e,t,r||e)}function c(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function s(e,t){return e(t={exports:{}},t.exports),t.exports}var l="object"==typeof f&&f&&f.Object===Object&&f,p="object"==typeof self&&self&&self.Object===Object&&self,v=l||p||Function("return this")(),d=v.Symbol,h=Object.prototype,y=h.hasOwnProperty,b=h.toString,_=d?d.toStringTag:void 0;var g=function(e){var t=y.call(e,_),r=e[_];try{e[_]=void 0;var n=!0}catch(e){}var o=b.call(e);return n&&(t?e[_]=r:delete e[_]),o},m=Object.prototype.toString;var j=function(e){return m.call(e)},O="[object Null]",w="[object Undefined]",D=d?d.toStringTag:void 0;var E=function(e){return null==e?void 0===e?w:O:D&&D in Object(e)?g(e):j(e)};var R=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},S="[object AsyncFunction]",P="[object Function]",k="[object GeneratorFunction]",x="[object Proxy]";var N,T=function(e){if(!R(e))return!1;var t=E(e);return t==P||t==k||t==S||t==x},A=v["__core-js_shared__"],C=(N=/[^.]+$/.exec(A&&A.keys&&A.keys.IE_PROTO||""))?"Symbol(src)_1."+N:"";var Y=function(e){return!!C&&C in e},z=Function.prototype.toString;var L=function(e){if(null!=e){try{return z.call(e)}catch(e){}try{return e+""}catch(e){}}return""},W=/^\[object .+?Constructor\]$/,$=Function.prototype,F=Object.prototype,M=$.toString,H=F.hasOwnProperty,I=RegExp("^"+M.call(H).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var U=function(e){return!(!R(e)||Y(e))&&(T(e)?I:W).test(L(e))};var V=function(e,t){return null==e?void 0:e[t]};var B=function(e,t){var r=V(e,t);return U(r)?r:void 0},q=function(){try{var e=B(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var G=function(e,t,r){"__proto__"==t&&q?q(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r};var J=function(e){return function(t,r,n){for(var o=-1,a=Object(t),i=n(t),u=i.length;u--;){var c=i[e?u:++o];if(!1===r(a[c],c,a))break}return t}}();var K=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n};var Q=function(e){return null!=e&&"object"==typeof e},X="[object Arguments]";var Z=function(e){return Q(e)&&E(e)==X},ee=Object.prototype,te=ee.hasOwnProperty,re=ee.propertyIsEnumerable,ne=Z(function(){return arguments}())?Z:function(e){return Q(e)&&te.call(e,"callee")&&!re.call(e,"callee")},oe=Array.isArray;var ae=function(){return!1},ie=s(function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,o=n&&n.exports===r?v.Buffer:void 0,a=(o?o.isBuffer:void 0)||ae;e.exports=a}),ue=9007199254740991,ce=/^(?:0|[1-9]\d*)$/;var fe=function(e,t){var r=typeof e;return!!(t=null==t?ue:t)&&("number"==r||"symbol"!=r&&ce.test(e))&&e>-1&&e%1==0&&e<t},se=9007199254740991;var le=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=se},pe={};pe["[object Float32Array]"]=pe["[object Float64Array]"]=pe["[object Int8Array]"]=pe["[object Int16Array]"]=pe["[object Int32Array]"]=pe["[object Uint8Array]"]=pe["[object Uint8ClampedArray]"]=pe["[object Uint16Array]"]=pe["[object Uint32Array]"]=!0,pe["[object Arguments]"]=pe["[object Array]"]=pe["[object ArrayBuffer]"]=pe["[object Boolean]"]=pe["[object DataView]"]=pe["[object Date]"]=pe["[object Error]"]=pe["[object Function]"]=pe["[object Map]"]=pe["[object Number]"]=pe["[object Object]"]=pe["[object RegExp]"]=pe["[object Set]"]=pe["[object String]"]=pe["[object WeakMap]"]=!1;var ve=function(e){return Q(e)&&le(e.length)&&!!pe[E(e)]};var de=function(e){return function(t){return e(t)}},he=s(function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,o=n&&n.exports===r&&l.process,a=function(){try{var e=n&&n.require&&n.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=a}),ye=he&&he.isTypedArray,be=ye?de(ye):ve,_e=Object.prototype.hasOwnProperty;var ge=function(e,t){var r=oe(e),n=!r&&ne(e),o=!r&&!n&&ie(e),a=!r&&!n&&!o&&be(e),i=r||n||o||a,u=i?K(e.length,String):[],c=u.length;for(var f in e)!t&&!_e.call(e,f)||i&&("length"==f||o&&("offset"==f||"parent"==f)||a&&("buffer"==f||"byteLength"==f||"byteOffset"==f)||fe(f,c))||u.push(f);return u},me=Object.prototype;var je=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||me)};var Oe=function(e,t){return function(r){return e(t(r))}},we=Oe(Object.keys,Object),De=Object.prototype.hasOwnProperty;var Ee=function(e){if(!je(e))return we(e);var t=[];for(var r in Object(e))De.call(e,r)&&"constructor"!=r&&t.push(r);return t};var Re=function(e){return null!=e&&le(e.length)&&!T(e)};var Se=function(e){return Re(e)?ge(e):Ee(e)};var Pe=function(e,t){return e&&J(e,t,Se)};var ke=function(){this.__data__=[],this.size=0};var xe=function(e,t){return e===t||e!=e&&t!=t};var Ne=function(e,t){for(var r=e.length;r--;)if(xe(e[r][0],t))return r;return-1},Te=Array.prototype.splice;var Ae=function(e){var t=this.__data__,r=Ne(t,e);return!(r<0||(r==t.length-1?t.pop():Te.call(t,r,1),--this.size,0))};var Ce=function(e){var t=this.__data__,r=Ne(t,e);return r<0?void 0:t[r][1]};var Ye=function(e){return Ne(this.__data__,e)>-1};var ze=function(e,t){var r=this.__data__,n=Ne(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};function Le(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Le.prototype.clear=ke,Le.prototype.delete=Ae,Le.prototype.get=Ce,Le.prototype.has=Ye,Le.prototype.set=ze;var We=Le;var $e=function(){this.__data__=new We,this.size=0};var Fe=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r};var Me=function(e){return this.__data__.get(e)};var He=function(e){return this.__data__.has(e)},Ie=B(v,"Map"),Ue=B(Object,"create");var Ve=function(){this.__data__=Ue?Ue(null):{},this.size=0};var Be=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},qe="__lodash_hash_undefined__",Ge=Object.prototype.hasOwnProperty;var Je=function(e){var t=this.__data__;if(Ue){var r=t[e];return r===qe?void 0:r}return Ge.call(t,e)?t[e]:void 0},Ke=Object.prototype.hasOwnProperty;var Qe=function(e){var t=this.__data__;return Ue?void 0!==t[e]:Ke.call(t,e)},Xe="__lodash_hash_undefined__";var Ze=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Ue&&void 0===t?Xe:t,this};function et(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}et.prototype.clear=Ve,et.prototype.delete=Be,et.prototype.get=Je,et.prototype.has=Qe,et.prototype.set=Ze;var tt=et;var rt=function(){this.size=0,this.__data__={hash:new tt,map:new(Ie||We),string:new tt}};var nt=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var ot=function(e,t){var r=e.__data__;return nt(t)?r["string"==typeof t?"string":"hash"]:r.map};var at=function(e){var t=ot(this,e).delete(e);return this.size-=t?1:0,t};var it=function(e){return ot(this,e).get(e)};var ut=function(e){return ot(this,e).has(e)};var ct=function(e,t){var r=ot(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};function ft(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ft.prototype.clear=rt,ft.prototype.delete=at,ft.prototype.get=it,ft.prototype.has=ut,ft.prototype.set=ct;var st=ft,lt=200;var pt=function(e,t){var r=this.__data__;if(r instanceof We){var n=r.__data__;if(!Ie||n.length<lt-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new st(n)}return r.set(e,t),this.size=r.size,this};function vt(e){var t=this.__data__=new We(e);this.size=t.size}vt.prototype.clear=$e,vt.prototype.delete=Fe,vt.prototype.get=Me,vt.prototype.has=He,vt.prototype.set=pt;var dt=vt,ht="__lodash_hash_undefined__";var yt=function(e){return this.__data__.set(e,ht),this};var bt=function(e){return this.__data__.has(e)};function _t(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new st;++t<r;)this.add(e[t])}_t.prototype.add=_t.prototype.push=yt,_t.prototype.has=bt;var gt=_t;var mt=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1};var jt=function(e,t){return e.has(t)},Ot=1,wt=2;var Dt=function(e,t,r,n,o,a){var i=r&Ot,u=e.length,c=t.length;if(u!=c&&!(i&&c>u))return!1;var f=a.get(e);if(f&&a.get(t))return f==t;var s=-1,l=!0,p=r&wt?new gt:void 0;for(a.set(e,t),a.set(t,e);++s<u;){var v=e[s],d=t[s];if(n)var h=i?n(d,v,s,t,e,a):n(v,d,s,e,t,a);if(void 0!==h){if(h)continue;l=!1;break}if(p){if(!mt(t,function(e,t){if(!jt(p,t)&&(v===e||o(v,e,r,n,a)))return p.push(t)})){l=!1;break}}else if(v!==d&&!o(v,d,r,n,a)){l=!1;break}}return a.delete(e),a.delete(t),l},Et=v.Uint8Array;var Rt=function(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r};var St=function(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r},Pt=1,kt=2,xt="[object Boolean]",Nt="[object Date]",Tt="[object Error]",At="[object Map]",Ct="[object Number]",Yt="[object RegExp]",zt="[object Set]",Lt="[object String]",Wt="[object Symbol]",$t="[object ArrayBuffer]",Ft="[object DataView]",Mt=d?d.prototype:void 0,Ht=Mt?Mt.valueOf:void 0;var It=function(e,t,r,n,o,a,i){switch(r){case Ft:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case $t:return!(e.byteLength!=t.byteLength||!a(new Et(e),new Et(t)));case xt:case Nt:case Ct:return xe(+e,+t);case Tt:return e.name==t.name&&e.message==t.message;case Yt:case Lt:return e==t+"";case At:var u=Rt;case zt:var c=n&Pt;if(u||(u=St),e.size!=t.size&&!c)return!1;var f=i.get(e);if(f)return f==t;n|=kt,i.set(e,t);var s=Dt(u(e),u(t),n,o,a,i);return i.delete(e),s;case Wt:if(Ht)return Ht.call(e)==Ht.call(t)}return!1};var Ut=function(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e};var Vt=function(e,t,r){var n=t(e);return oe(e)?n:Ut(n,r(e))};var Bt=function(e,t){for(var r=-1,n=null==e?0:e.length,o=0,a=[];++r<n;){var i=e[r];t(i,r,e)&&(a[o++]=i)}return a};var qt=function(){return[]},Gt=Object.prototype.propertyIsEnumerable,Jt=Object.getOwnPropertySymbols,Kt=Jt?function(e){return null==e?[]:(e=Object(e),Bt(Jt(e),function(t){return Gt.call(e,t)}))}:qt;var Qt=function(e){return Vt(e,Se,Kt)},Xt=1,Zt=Object.prototype.hasOwnProperty;var er=function(e,t,r,n,o,a){var i=r&Xt,u=Qt(e),c=u.length;if(c!=Qt(t).length&&!i)return!1;for(var f=c;f--;){var s=u[f];if(!(i?s in t:Zt.call(t,s)))return!1}var l=a.get(e);if(l&&a.get(t))return l==t;var p=!0;a.set(e,t),a.set(t,e);for(var v=i;++f<c;){var d=e[s=u[f]],h=t[s];if(n)var y=i?n(h,d,s,t,e,a):n(d,h,s,e,t,a);if(!(void 0===y?d===h||o(d,h,r,n,a):y)){p=!1;break}v||(v="constructor"==s)}if(p&&!v){var b=e.constructor,_=t.constructor;b!=_&&"constructor"in e&&"constructor"in t&&!("function"==typeof b&&b instanceof b&&"function"==typeof _&&_ instanceof _)&&(p=!1)}return a.delete(e),a.delete(t),p},tr=B(v,"DataView"),rr=B(v,"Promise"),nr=B(v,"Set"),or=B(v,"WeakMap"),ar=L(tr),ir=L(Ie),ur=L(rr),cr=L(nr),fr=L(or),sr=E;(tr&&"[object DataView]"!=sr(new tr(new ArrayBuffer(1)))||Ie&&"[object Map]"!=sr(new Ie)||rr&&"[object Promise]"!=sr(rr.resolve())||nr&&"[object Set]"!=sr(new nr)||or&&"[object WeakMap]"!=sr(new or))&&(sr=function(e){var t=E(e),r="[object Object]"==t?e.constructor:void 0,n=r?L(r):"";if(n)switch(n){case ar:return"[object DataView]";case ir:return"[object Map]";case ur:return"[object Promise]";case cr:return"[object Set]";case fr:return"[object WeakMap]"}return t});var lr=sr,pr=1,vr="[object Arguments]",dr="[object Array]",hr="[object Object]",yr=Object.prototype.hasOwnProperty;var br=function(e,t,r,n,o,a){var i=oe(e),u=oe(t),c=i?dr:lr(e),f=u?dr:lr(t),s=(c=c==vr?hr:c)==hr,l=(f=f==vr?hr:f)==hr,p=c==f;if(p&&ie(e)){if(!ie(t))return!1;i=!0,s=!1}if(p&&!s)return a||(a=new dt),i||be(e)?Dt(e,t,r,n,o,a):It(e,t,c,r,n,o,a);if(!(r&pr)){var v=s&&yr.call(e,"__wrapped__"),d=l&&yr.call(t,"__wrapped__");if(v||d){var h=v?e.value():e,y=d?t.value():t;return a||(a=new dt),o(h,y,r,n,a)}}return!!p&&(a||(a=new dt),er(e,t,r,n,o,a))};var _r=function e(t,r,n,o,a){return t===r||(null==t||null==r||!Q(t)&&!Q(r)?t!=t&&r!=r:br(t,r,n,o,e,a))},gr=1,mr=2;var jr=function(e,t,r,n){var o=r.length,a=o,i=!n;if(null==e)return!a;for(e=Object(e);o--;){var u=r[o];if(i&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++o<a;){var c=(u=r[o])[0],f=e[c],s=u[1];if(i&&u[2]){if(void 0===f&&!(c in e))return!1}else{var l=new dt;if(n)var p=n(f,s,c,e,t,l);if(!(void 0===p?_r(s,f,gr|mr,n,l):p))return!1}}return!0};var Or=function(e){return e==e&&!R(e)};var wr=function(e){for(var t=Se(e),r=t.length;r--;){var n=t[r],o=e[n];t[r]=[n,o,Or(o)]}return t};var Dr=function(e,t){return function(r){return null!=r&&r[e]===t&&(void 0!==t||e in Object(r))}};var Er=function(e){var t=wr(e);return 1==t.length&&t[0][2]?Dr(t[0][0],t[0][1]):function(r){return r===e||jr(r,e,t)}},Rr="[object Symbol]";var Sr=function(e){return"symbol"==typeof e||Q(e)&&E(e)==Rr},Pr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,kr=/^\w*$/;var xr=function(e,t){if(oe(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!Sr(e))||kr.test(e)||!Pr.test(e)||null!=t&&e in Object(t)},Nr="Expected a function";function Tr(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(Nr);var r=function(){var n=arguments,o=t?t.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var i=e.apply(this,n);return r.cache=a.set(o,i)||a,i};return r.cache=new(Tr.Cache||st),r}Tr.Cache=st;var Ar=Tr,Cr=500;var Yr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,zr=/\\(\\)?/g,Lr=function(e){var t=Ar(e,function(e){return r.size===Cr&&r.clear(),e}),r=t.cache;return t}(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Yr,function(e,r,n,o){t.push(n?o.replace(zr,"$1"):r||e)}),t});var Wr=function(e,t){for(var r=-1,n=null==e?0:e.length,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o},$r=1/0,Fr=d?d.prototype:void 0,Mr=Fr?Fr.toString:void 0;var Hr=function e(t){if("string"==typeof t)return t;if(oe(t))return Wr(t,e)+"";if(Sr(t))return Mr?Mr.call(t):"";var r=t+"";return"0"==r&&1/t==-$r?"-0":r};var Ir=function(e){return null==e?"":Hr(e)};var Ur=function(e,t){return oe(e)?e:xr(e,t)?[e]:Lr(Ir(e))},Vr=1/0;var Br=function(e){if("string"==typeof e||Sr(e))return e;var t=e+"";return"0"==t&&1/e==-Vr?"-0":t};var qr=function(e,t){for(var r=0,n=(t=Ur(t,e)).length;null!=e&&r<n;)e=e[Br(t[r++])];return r&&r==n?e:void 0};var Gr=function(e,t,r){var n=null==e?void 0:qr(e,t);return void 0===n?r:n};var Jr=function(e,t){return null!=e&&t in Object(e)};var Kr=function(e,t,r){for(var n=-1,o=(t=Ur(t,e)).length,a=!1;++n<o;){var i=Br(t[n]);if(!(a=null!=e&&r(e,i)))break;e=e[i]}return a||++n!=o?a:!!(o=null==e?0:e.length)&&le(o)&&fe(i,o)&&(oe(e)||ne(e))};var Qr=function(e,t){return null!=e&&Kr(e,t,Jr)},Xr=1,Zr=2;var en=function(e,t){return xr(e)&&Or(t)?Dr(Br(e),t):function(r){var n=Gr(r,e);return void 0===n&&n===t?Qr(r,e):_r(t,n,Xr|Zr)}};var tn=function(e){return e};var rn=function(e){return function(t){return null==t?void 0:t[e]}};var nn=function(e){return function(t){return qr(t,e)}};var on=function(e){return xr(e)?rn(Br(e)):nn(e)};var an=function(e){return"function"==typeof e?e:null==e?tn:"object"==typeof e?oe(e)?en(e[0],e[1]):Er(e):on(e)};var un,cn=function(e,t){var r={};return t=an(t),Pe(e,function(e,n,o){G(r,n,t(e,n,o))}),r},fn={different:"different",deepEquals:"deepEquals",date:"date",regex:"regex",reactElement:"reactElement",function:"function"},sn="function"==typeof Symbol&&Symbol.for,ln=sn?Symbol.for("react.memo"):60115,pn=sn?Symbol.for("react.forward_ref"):60112,vn="http://bit.ly/wdyr02",dn="http://bit.ly/wdyr3",hn=(t(un={},fn.different,"different objects."),t(un,fn.deepEquals,"different objects that are equal by value."),t(un,fn.date,"different date objects with the same value."),t(un,fn.regex,"different regular expressions with the same value."),t(un,fn.reactElement,"different React elements with the same displayName."),t(un,fn.function,"different functions with the same name."),un),yn=!1;function bn(e){var r=e.Component,n=e.displayName,o=e.hookName,a=e.prefixMessage,i=e.diffObjType,u=e.differences,c=e.values,f=e.options;u&&u.length>0?(f.consoleLog(t({},n,r),"".concat(a," of ").concat(i," changes:")),u.forEach(function(e){var r=e.pathString,n=e.diffType,a=e.prevValue,u=e.nextValue;f.consoleGroup("%c".concat("hook"===i?"[hook ".concat(o," result]"):"".concat(i,"."),"%c").concat(r,"%c"),"color:".concat(f.diffNameColor,";"),"color:".concat(f.diffPathColor,";"),"color:default;"),f.consoleLog("".concat(hn[n]," (more info at ").concat(o?dn:vn,")")),f.consoleLog(t({},"prev ".concat(r),a),"!==",t({},"next ".concat(r),u)),f.consoleGroupEnd()})):u&&(f.consoleLog(t({},n,r),"".concat(a," the ").concat(i," object itself changed but its values are all equal."),"props"===i?"This could have been avoided by making the component pure, or by preventing its father from re-rendering.":"This usually means this component called setState when no changes in its state actually occurred.","More info at ".concat(vn)),f.consoleLog("prev ".concat(i,":"),c.prev," !== ",c.next,":next ".concat(i)))}function _n(e){var r=e.Component,n=e.displayName,o=e.hookName,a=e.prevProps,i=e.prevState,u=e.prevHook,c=e.nextProps,f=e.nextState,s=e.nextHook,l=e.reason,p=e.options;if(function(e,t,r){return!(yn||!r.logOnDifferentValues&&(!t.whyDidYouRender||!t.whyDidYouRender.logOnDifferentValues)&&(e.propsDifferences&&e.propsDifferences.some(function(e){return e.diffType===fn.different})||e.stateDifferences&&e.stateDifferences.some(function(e){return e.diffType===fn.different})||e.hookDifferences&&e.hookDifferences.some(function(e){return e.diffType===fn.different})))}(l,r,p)){p.consoleGroup("%c".concat(n),"color: ".concat(p.titleColor,";"));var v="Re-rendered because";l.propsDifferences&&(bn({Component:r,displayName:n,prefixMessage:v,diffObjType:"props",differences:l.propsDifferences,values:{prev:a,next:c},options:p}),v="And because"),l.stateDifferences&&bn({Component:r,displayName:n,prefixMessage:v,diffObjType:"state",differences:l.stateDifferences,values:{prev:i,next:f},options:p}),l.hookDifferences&&bn({Component:r,displayName:n,prefixMessage:v,diffObjType:"hook",differences:l.hookDifferences,values:{prev:u,next:s},hookName:o,options:p}),l.propsDifferences||l.stateDifferences||l.hookDifferences||p.consoleLog(t({},n,r),"Re-rendered although props and state objects are the same.","This usually means there was a call to this.forceUpdate() inside the component.","more info at ".concat(vn)),p.consoleGroupEnd()}}var gn=function(){};function mn(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=console.group,o=console.groupEnd;return t.collapseGroups?r=console.groupCollapsed:t.onlyLogs&&(r=console.log,o=gn),n({include:null,exclude:null,notifier:t.notifier||((e="hotReloadBufferMs"in t?t.hotReloadBufferMs:500)&&module&&module.hot&&module.hot.addStatusHandler&&module.hot.addStatusHandler(function(t){"idle"===t&&(yn=!0,setTimeout(function(){yn=!1},e))}),_n),onlyLogs:!1,consoleLog:console.log,consoleGroup:r,consoleGroupEnd:o,logOnDifferentValues:!1,trackHooks:!0,titleColor:"#058",diffNameColor:"blue",diffPathColor:"red"},t)}var jn="[object String]";var On=function(e){return"string"==typeof e||!oe(e)&&Q(e)&&E(e)==jn};function wn(e){return e.displayName||e.name||e.type&&wn(e.type)||e.render&&wn(e.render)||(On(e)?e:void 0)}var Dn=function(e,t,r,n){var o=-1,a=null==e?0:e.length;for(n&&a&&(r=e[++o]);++o<a;)r=t(r,e[o],o,e);return r};var En=function(e,t){return function(r,n){if(null==r)return r;if(!Re(r))return e(r,n);for(var o=r.length,a=t?o:-1,i=Object(r);(t?a--:++a<o)&&!1!==n(i[a],a,i););return r}}(Pe);var Rn=function(e,t,r,n,o){return o(e,function(e,o,a){r=n?(n=!1,e):t(r,e,o,a)}),r};var Sn=function(e,t,r){var n=oe(e)?Dn:Rn,o=arguments.length<3;return n(e,an(t),r,o,En)},Pn=Object.prototype.hasOwnProperty;var kn=function(e,t){return null!=e&&Pn.call(e,t)};var xn=function(e,t){return null!=e&&Kr(e,t,kn)},Nn="[object RegExp]";var Tn=function(e){return Q(e)&&E(e)==Nn},An=he&&he.isRegExp,Cn=An?de(An):Tn,Yn="[object Date]";var zn=function(e){return Q(e)&&E(e)==Yn},Ln=he&&he.isDate,Wn=Ln?de(Ln):zn,$n=Oe(Object.getPrototypeOf,Object),Fn="[object Object]",Mn=Function.prototype,Hn=Object.prototype,In=Mn.toString,Un=Hn.hasOwnProperty,Vn=In.call(Object);var Bn=function(e){if(!Q(e)||E(e)!=Fn)return!1;var t=$n(e);if(null===t)return!0;var r=Un.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&In.call(r)==Vn},qn="undefined"!=typeof Element,Gn="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103,Jn=function(e){return e.$$typeof===Gn};function Kn(e,t,r,n,o){return r.push({diffType:o,pathString:n,prevValue:e,nextValue:t}),o!==fn.different}function Qn(e,t,r){try{var n=[];return function e(t,r,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";if(t===r)return!0;if(!t||!r)return Kn(t,r,n,o,fn.different);if(oe(t)&&oe(r)){var a=t.length;if(a!==r.length)return Kn(t,r,n,o,fn.different);for(var i=!0,u=a;0!=u--;)e(t[u],r[u],n,"".concat(o,"[").concat(u,"]"))||(i=!1);return Kn(t,r,n,o,i?fn.deepEquals:fn.different)}if(Wn(t)&&Wn(r))return t.getTime()===r.getTime()?Kn(t,r,n,o,fn.date):Kn(t,r,n,o,fn.different);if(Cn(t)&&Cn(r))return t.toString()===r.toString()?Kn(t,r,n,o,fn.regex):Kn(t,r,n,o,fn.different);if(qn&&t instanceof Element&&r instanceof Element)return Kn(t,r,n,o,fn.different);if(Jn(t)&&Jn(r))return t.type!==r.type?Kn(t,r,n,o,fn.different):Kn(t,r,n,o,e(t.props,r.props,n,"".concat(o,".props"))?fn.reactElement:fn.different);if(T(t)&&T(r))return t.name===r.name?Kn(t,r,n,o,fn.function):Kn(t,r,n,o,fn.different);if(Bn(t)&&Bn(r)){var c=Se(t),f=c.length;if(f!==Se(r).length)return Kn(t,r,n,o,fn.different);for(var s=f;0!=s--;)if(!xn(r,c[s]))return Kn(t,r,n,o,fn.different);for(var l=!0,p=f;0!=p--;){var v=c[p];e(t[v],r[v],n,"".concat(o,".").concat(v))||(l=!1)}return Kn(t,r,n,o,l?fn.deepEquals:fn.different)}return Kn(t,r,n,o,fn.different)}(e,t,n,r),n}catch(e){if(e.message&&e.message.match(/stack|recursion/i)||-2146828260===e.number)return console.warn("Warning: why-did-you-render couldn't handle circular references in props.",e.name,e.message),!1;throw e}}var Xn={};function Zn(e,t){var r=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).shallow;if(e===t)return!1;if(!(void 0===r||r))return Qn(e,t);var o=e||Xn,a=t||Xn,i=Object.keys(n({},o,{},a));return Sn(i,function(e,t){var r=Qn(o[t],a[t],t);return r&&(e=[].concat(c(e),c(r))),e},[])}function eo(e,t,r,n,o,a){return{propsDifferences:Zn(e,n),stateDifferences:Zn(t,o),hookDifferences:Zn(r,a,{shallow:!1})}}function to(e){var t=e.Component,r=e.displayName,n=e.hookName,o=e.prevProps,a=e.prevState,i=e.prevHook,u=e.nextProps,c=e.nextState,f=e.nextHook;return{Component:t,displayName:r,hookName:n,prevProps:o,prevState:a,prevHook:i,nextProps:u,nextState:c,nextHook:f,options:e.options,reason:eo(o,a,i,u,c,f)}}function ro(e,t,r){return!function(e,t){return t.exclude&&t.exclude.length>0&&t.exclude.some(function(t){return t.test(e)})}(t,r)&&!(!e.whyDidYouRender&&!function(e,t){return t.include&&t.include.length>0&&t.include.some(function(t){return t.test(e)})}(t,r))}var no=function(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)},oo=Math.max;var ao=function(e,t,r){return t=oo(void 0===t?e.length-1:t,0),function(){for(var n=arguments,o=-1,a=oo(n.length-t,0),i=Array(a);++o<a;)i[o]=n[t+o];o=-1;for(var u=Array(t+1);++o<t;)u[o]=n[o];return u[t]=r(i),no(e,this,u)}};var io=function(e){return function(){return e}},uo=q?function(e,t){return q(e,"toString",{configurable:!0,enumerable:!1,value:io(t),writable:!0})}:tn,co=800,fo=16,so=Date.now;var lo=function(e){var t=0,r=0;return function(){var n=so(),o=fo-(n-r);if(r=n,o>0){if(++t>=co)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(uo);var po=function(e,t){return lo(ao(e,t,tn),e+"")};var vo=function(e,t,r){if(!R(r))return!1;var n=typeof t;return!!("number"==n?Re(r)&&fe(t,r.length):"string"==n&&t in r)&&xe(r[t],e)};var ho=function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t},yo=Object.prototype.hasOwnProperty;var bo=function(e){if(!R(e))return ho(e);var t=je(e),r=[];for(var n in e)("constructor"!=n||!t&&yo.call(e,n))&&r.push(n);return r};var _o=function(e){return Re(e)?ge(e,!0):bo(e)},go=Object.prototype,mo=go.hasOwnProperty,jo=po(function(e,t){e=Object(e);var r=-1,n=t.length,o=n>2?t[2]:void 0;for(o&&vo(t[0],t[1],o)&&(n=1);++r<n;)for(var a=t[r],i=_o(a),u=-1,c=i.length;++u<c;){var f=i[u],s=e[f];(void 0===s||xe(s,go[f])&&!mo.call(e,f))&&(e[f]=a[f])}return e}),Oo=2;function wo(t,r,n,c){var f=function(n){function f(e,r){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,f),(n=function(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?i(e):t}(this,o(f).call(this,e,r)))._WDYR={renderNumber:0};var a=u(o(f.prototype),"render",i(n))||n.render;return a!==t.prototype.render&&(n.render=function(){return f.prototype.render.apply(i(n)),a()}),n}var s,l,p;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&a(e,t)}(f,t),s=f,(l=[{key:"render",value:function(){return this._WDYR.renderNumber++,"isStrictMode"in this._WDYR||(this._WDYR.isStrictMode=function(e){for(var t=e._reactInternalFiber;t;){if(t.mode&Oo)return!0;t=t.return}return!1}(this)),this._WDYR.isStrictMode&&this._WDYR.renderNumber%2==1||(this._WDYR.prevProps&&c.notifier(to({Component:t,displayName:r,prevProps:this._WDYR.prevProps,prevState:this._WDYR.prevState,nextProps:this.props,nextState:this.state,options:c})),this._WDYR.prevProps=this.props,this._WDYR.prevState=this.state),u(o(f.prototype),"render",this)?u(o(f.prototype),"render",this).call(this):null}}])&&e(s.prototype,l),p&&e(s,p),f}();return f.displayName=r,jo(f,t),f}function Do(e,t,r,n,o){var a=t.path,i=r,u=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner.current;if(!u)return i;var c=u.type.ComponentForHooksTracking||u.type,f=wn(c);if(!ro(c,f,o))return i;var s=n.useRef(),l=s.current;if(s.current=i,l){var p=to({Component:c,displayName:f,hookName:e,prevHook:a?Gr(l,a):l,nextHook:a?Gr(i,a):i,options:o});p.reason.hookDifferences&&o.notifier(p)}return s.current}function Eo(e,t,r,n,o){return t.$$typeof===ln?function(e,t,r,n){var o=e.type,a=o.$$typeof===pn,i=a?o.render:o;function u(){var o=arguments[0],a=r.useRef(),u=a.current;if(a.current=o,u){var c=to({Component:e,displayName:t,prevProps:u,nextProps:o,options:n});c.reason.propsDifferences&&c.reason.propsDifferences.length>0&&n.notifier(c)}return i.apply(void 0,arguments)}u.displayName=wn(i),u.ComponentForHooksTracking=e,jo(u,i);var c=r.memo(a?r.forwardRef(u):u,e.compare);return c.displayName=t,jo(c,e),c}(t,r,n,o):t.$$typeof===pn?function(e,t,r,n){var o=e.render,a=o.$$typeof===ln,i=a?o.type:o;function u(){var o=arguments[0],a=r.useRef(),u=a.current;if(a.current=o,u){var c=to({Component:e,displayName:t,prevProps:u,nextProps:o,options:n});c.reason.propsDifferences&&c.reason.propsDifferences.length>0&&n.notifier(c)}return i.apply(void 0,arguments)}u.displayName=wn(i),u.ComponentForHooksTracking=i,jo(u,i);var c=r.forwardRef(a?r.memo(u,o.compare):u);return c.displayName=t,jo(c,e),c}(t,r,n,o):t.prototype&&t.prototype.isReactComponent?wo(t,r,0,o):function(e,t,r,n){function o(o){var a=r.useRef(),i=a.current;if(a.current=o,i){var u=to({Component:e,displayName:t,prevProps:i,nextProps:o,options:n});u.reason.propsDifferences&&n.notifier(u)}return e(o)}return o.displayName=t,o.ComponentForHooksTracking=e,jo(o,e),o}(t,r,n,o)}function Ro(e,t,r,n,o){if(e.has(t))return e.get(t);var a=Eo(0,t,r,n,o);return e.set(t,a),a}var So={useState:{path:"0"},useReducer:{path:"0"},useContext:!0,useMemo:!0};function Po(e,t){var r,o=mn(t),a=e.createElement,i=e.createFactory,u=new WeakMap;if(e.createElement=function(t){for(var r=null,n=null,i=null,c=arguments.length,f=new Array(c>1?c-1:0),s=1;s<c;s++)f[s-1]=arguments[s];try{if(r=("function"==typeof t||t.$$typeof===ln||t.$$typeof===pn)&&ro(t,wn(t),o))return n=t&&t.whyDidYouRender&&t.whyDidYouRender.customName||wn(t),i=Ro(u,t,n,e,o),a.apply(e,[i].concat(f))}catch(e){o.consoleLog("whyDidYouRender error. Please file a bug at https://github.com/welldone-software/why-did-you-render/issues.",{errorInfo:{error:e,componentNameOrComponent:t,rest:f,options:o,isShouldTrack:r,displayName:n,WDYRPatchedComponent:i}})}return a.apply(e,[t].concat(f))},Object.assign(e.createElement,a),e.createFactory=function(t){var r=e.createElement.bind(null,t);return r.type=t,r},Object.assign(e.createFactory,i),o.trackHooks){var c=cn(So,function(t,n){return function(){var a=r[n];if(!a)throw new Error("[WhyDidYouRender] A problem with React Hooks patching occurred.");var i=a.apply(void 0,arguments);return t&&Do(n,!0===t?{}:t,i,e,o),i}});Object.defineProperty(e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher,"current",{set:function(e){r=e&&n({},e,{},e.origHooks)},get:function(){return r&&n({},r,{},c,{origHooks:r})}})}return e.__REVERT_WHY_DID_YOU_RENDER__=function(){Object.assign(e,{createElement:a,createFactory:i}),u=null,Object.defineProperty(e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher,"current",{writable:!0,value:r}),delete e.__REVERT_WHY_DID_YOU_RENDER__},e}return Po.defaultNotifier=_n,Po}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).whyDidYouRender=t()}(this,function(){"use strict";function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function t(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function r(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function n(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?r(o,!0).forEach(function(r){t(e,r,o[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):r(o).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function u(e,t,r){return(u="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=o(e)););return e}(e,t);if(n){var a=Object.getOwnPropertyDescriptor(n,t);return a.get?a.get.call(r):a.value}})(e,t,r||e)}function c(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function s(e,t){return e(t={exports:{}},t.exports),t.exports}var l="object"==typeof f&&f&&f.Object===Object&&f,p="object"==typeof self&&self&&self.Object===Object&&self,v=l||p||Function("return this")(),d=v.Symbol,h=Object.prototype,y=h.hasOwnProperty,b=h.toString,_=d?d.toStringTag:void 0;var g=function(e){var t=y.call(e,_),r=e[_];try{e[_]=void 0;var n=!0}catch(e){}var o=b.call(e);return n&&(t?e[_]=r:delete e[_]),o},m=Object.prototype.toString;var j=function(e){return m.call(e)},O="[object Null]",w="[object Undefined]",D=d?d.toStringTag:void 0;var E=function(e){return null==e?void 0===e?w:O:D&&D in Object(e)?g(e):j(e)};var R=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},S="[object AsyncFunction]",P="[object Function]",k="[object GeneratorFunction]",x="[object Proxy]";var N,T=function(e){if(!R(e))return!1;var t=E(e);return t==P||t==k||t==S||t==x},A=v["__core-js_shared__"],C=(N=/[^.]+$/.exec(A&&A.keys&&A.keys.IE_PROTO||""))?"Symbol(src)_1."+N:"";var Y=function(e){return!!C&&C in e},z=Function.prototype.toString;var L=function(e){if(null!=e){try{return z.call(e)}catch(e){}try{return e+""}catch(e){}}return""},W=/^\[object .+?Constructor\]$/,$=Function.prototype,F=Object.prototype,M=$.toString,H=F.hasOwnProperty,I=RegExp("^"+M.call(H).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var U=function(e){return!(!R(e)||Y(e))&&(T(e)?I:W).test(L(e))};var V=function(e,t){return null==e?void 0:e[t]};var B=function(e,t){var r=V(e,t);return U(r)?r:void 0},q=function(){try{var e=B(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var G=function(e,t,r){"__proto__"==t&&q?q(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r};var J=function(e){return function(t,r,n){for(var o=-1,a=Object(t),i=n(t),u=i.length;u--;){var c=i[e?u:++o];if(!1===r(a[c],c,a))break}return t}}();var K=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n};var Q=function(e){return null!=e&&"object"==typeof e},X="[object Arguments]";var Z=function(e){return Q(e)&&E(e)==X},ee=Object.prototype,te=ee.hasOwnProperty,re=ee.propertyIsEnumerable,ne=Z(function(){return arguments}())?Z:function(e){return Q(e)&&te.call(e,"callee")&&!re.call(e,"callee")},oe=Array.isArray;var ae=function(){return!1},ie=s(function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,o=n&&n.exports===r?v.Buffer:void 0,a=(o?o.isBuffer:void 0)||ae;e.exports=a}),ue=9007199254740991,ce=/^(?:0|[1-9]\d*)$/;var fe=function(e,t){var r=typeof e;return!!(t=null==t?ue:t)&&("number"==r||"symbol"!=r&&ce.test(e))&&e>-1&&e%1==0&&e<t},se=9007199254740991;var le=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=se},pe={};pe["[object Float32Array]"]=pe["[object Float64Array]"]=pe["[object Int8Array]"]=pe["[object Int16Array]"]=pe["[object Int32Array]"]=pe["[object Uint8Array]"]=pe["[object Uint8ClampedArray]"]=pe["[object Uint16Array]"]=pe["[object Uint32Array]"]=!0,pe["[object Arguments]"]=pe["[object Array]"]=pe["[object ArrayBuffer]"]=pe["[object Boolean]"]=pe["[object DataView]"]=pe["[object Date]"]=pe["[object Error]"]=pe["[object Function]"]=pe["[object Map]"]=pe["[object Number]"]=pe["[object Object]"]=pe["[object RegExp]"]=pe["[object Set]"]=pe["[object String]"]=pe["[object WeakMap]"]=!1;var ve=function(e){return Q(e)&&le(e.length)&&!!pe[E(e)]};var de=function(e){return function(t){return e(t)}},he=s(function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,o=n&&n.exports===r&&l.process,a=function(){try{var e=n&&n.require&&n.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=a}),ye=he&&he.isTypedArray,be=ye?de(ye):ve,_e=Object.prototype.hasOwnProperty;var ge=function(e,t){var r=oe(e),n=!r&&ne(e),o=!r&&!n&&ie(e),a=!r&&!n&&!o&&be(e),i=r||n||o||a,u=i?K(e.length,String):[],c=u.length;for(var f in e)!t&&!_e.call(e,f)||i&&("length"==f||o&&("offset"==f||"parent"==f)||a&&("buffer"==f||"byteLength"==f||"byteOffset"==f)||fe(f,c))||u.push(f);return u},me=Object.prototype;var je=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||me)};var Oe=function(e,t){return function(r){return e(t(r))}},we=Oe(Object.keys,Object),De=Object.prototype.hasOwnProperty;var Ee=function(e){if(!je(e))return we(e);var t=[];for(var r in Object(e))De.call(e,r)&&"constructor"!=r&&t.push(r);return t};var Re=function(e){return null!=e&&le(e.length)&&!T(e)};var Se=function(e){return Re(e)?ge(e):Ee(e)};var Pe=function(e,t){return e&&J(e,t,Se)};var ke=function(){this.__data__=[],this.size=0};var xe=function(e,t){return e===t||e!=e&&t!=t};var Ne=function(e,t){for(var r=e.length;r--;)if(xe(e[r][0],t))return r;return-1},Te=Array.prototype.splice;var Ae=function(e){var t=this.__data__,r=Ne(t,e);return!(r<0||(r==t.length-1?t.pop():Te.call(t,r,1),--this.size,0))};var Ce=function(e){var t=this.__data__,r=Ne(t,e);return r<0?void 0:t[r][1]};var Ye=function(e){return Ne(this.__data__,e)>-1};var ze=function(e,t){var r=this.__data__,n=Ne(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};function Le(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Le.prototype.clear=ke,Le.prototype.delete=Ae,Le.prototype.get=Ce,Le.prototype.has=Ye,Le.prototype.set=ze;var We=Le;var $e=function(){this.__data__=new We,this.size=0};var Fe=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r};var Me=function(e){return this.__data__.get(e)};var He=function(e){return this.__data__.has(e)},Ie=B(v,"Map"),Ue=B(Object,"create");var Ve=function(){this.__data__=Ue?Ue(null):{},this.size=0};var Be=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},qe="__lodash_hash_undefined__",Ge=Object.prototype.hasOwnProperty;var Je=function(e){var t=this.__data__;if(Ue){var r=t[e];return r===qe?void 0:r}return Ge.call(t,e)?t[e]:void 0},Ke=Object.prototype.hasOwnProperty;var Qe=function(e){var t=this.__data__;return Ue?void 0!==t[e]:Ke.call(t,e)},Xe="__lodash_hash_undefined__";var Ze=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Ue&&void 0===t?Xe:t,this};function et(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}et.prototype.clear=Ve,et.prototype.delete=Be,et.prototype.get=Je,et.prototype.has=Qe,et.prototype.set=Ze;var tt=et;var rt=function(){this.size=0,this.__data__={hash:new tt,map:new(Ie||We),string:new tt}};var nt=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var ot=function(e,t){var r=e.__data__;return nt(t)?r["string"==typeof t?"string":"hash"]:r.map};var at=function(e){var t=ot(this,e).delete(e);return this.size-=t?1:0,t};var it=function(e){return ot(this,e).get(e)};var ut=function(e){return ot(this,e).has(e)};var ct=function(e,t){var r=ot(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};function ft(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ft.prototype.clear=rt,ft.prototype.delete=at,ft.prototype.get=it,ft.prototype.has=ut,ft.prototype.set=ct;var st=ft,lt=200;var pt=function(e,t){var r=this.__data__;if(r instanceof We){var n=r.__data__;if(!Ie||n.length<lt-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new st(n)}return r.set(e,t),this.size=r.size,this};function vt(e){var t=this.__data__=new We(e);this.size=t.size}vt.prototype.clear=$e,vt.prototype.delete=Fe,vt.prototype.get=Me,vt.prototype.has=He,vt.prototype.set=pt;var dt=vt,ht="__lodash_hash_undefined__";var yt=function(e){return this.__data__.set(e,ht),this};var bt=function(e){return this.__data__.has(e)};function _t(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new st;++t<r;)this.add(e[t])}_t.prototype.add=_t.prototype.push=yt,_t.prototype.has=bt;var gt=_t;var mt=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1};var jt=function(e,t){return e.has(t)},Ot=1,wt=2;var Dt=function(e,t,r,n,o,a){var i=r&Ot,u=e.length,c=t.length;if(u!=c&&!(i&&c>u))return!1;var f=a.get(e);if(f&&a.get(t))return f==t;var s=-1,l=!0,p=r&wt?new gt:void 0;for(a.set(e,t),a.set(t,e);++s<u;){var v=e[s],d=t[s];if(n)var h=i?n(d,v,s,t,e,a):n(v,d,s,e,t,a);if(void 0!==h){if(h)continue;l=!1;break}if(p){if(!mt(t,function(e,t){if(!jt(p,t)&&(v===e||o(v,e,r,n,a)))return p.push(t)})){l=!1;break}}else if(v!==d&&!o(v,d,r,n,a)){l=!1;break}}return a.delete(e),a.delete(t),l},Et=v.Uint8Array;var Rt=function(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r};var St=function(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r},Pt=1,kt=2,xt="[object Boolean]",Nt="[object Date]",Tt="[object Error]",At="[object Map]",Ct="[object Number]",Yt="[object RegExp]",zt="[object Set]",Lt="[object String]",Wt="[object Symbol]",$t="[object ArrayBuffer]",Ft="[object DataView]",Mt=d?d.prototype:void 0,Ht=Mt?Mt.valueOf:void 0;var It=function(e,t,r,n,o,a,i){switch(r){case Ft:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case $t:return!(e.byteLength!=t.byteLength||!a(new Et(e),new Et(t)));case xt:case Nt:case Ct:return xe(+e,+t);case Tt:return e.name==t.name&&e.message==t.message;case Yt:case Lt:return e==t+"";case At:var u=Rt;case zt:var c=n&Pt;if(u||(u=St),e.size!=t.size&&!c)return!1;var f=i.get(e);if(f)return f==t;n|=kt,i.set(e,t);var s=Dt(u(e),u(t),n,o,a,i);return i.delete(e),s;case Wt:if(Ht)return Ht.call(e)==Ht.call(t)}return!1};var Ut=function(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e};var Vt=function(e,t,r){var n=t(e);return oe(e)?n:Ut(n,r(e))};var Bt=function(e,t){for(var r=-1,n=null==e?0:e.length,o=0,a=[];++r<n;){var i=e[r];t(i,r,e)&&(a[o++]=i)}return a};var qt=function(){return[]},Gt=Object.prototype.propertyIsEnumerable,Jt=Object.getOwnPropertySymbols,Kt=Jt?function(e){return null==e?[]:(e=Object(e),Bt(Jt(e),function(t){return Gt.call(e,t)}))}:qt;var Qt=function(e){return Vt(e,Se,Kt)},Xt=1,Zt=Object.prototype.hasOwnProperty;var er=function(e,t,r,n,o,a){var i=r&Xt,u=Qt(e),c=u.length;if(c!=Qt(t).length&&!i)return!1;for(var f=c;f--;){var s=u[f];if(!(i?s in t:Zt.call(t,s)))return!1}var l=a.get(e);if(l&&a.get(t))return l==t;var p=!0;a.set(e,t),a.set(t,e);for(var v=i;++f<c;){var d=e[s=u[f]],h=t[s];if(n)var y=i?n(h,d,s,t,e,a):n(d,h,s,e,t,a);if(!(void 0===y?d===h||o(d,h,r,n,a):y)){p=!1;break}v||(v="constructor"==s)}if(p&&!v){var b=e.constructor,_=t.constructor;b!=_&&"constructor"in e&&"constructor"in t&&!("function"==typeof b&&b instanceof b&&"function"==typeof _&&_ instanceof _)&&(p=!1)}return a.delete(e),a.delete(t),p},tr=B(v,"DataView"),rr=B(v,"Promise"),nr=B(v,"Set"),or=B(v,"WeakMap"),ar=L(tr),ir=L(Ie),ur=L(rr),cr=L(nr),fr=L(or),sr=E;(tr&&"[object DataView]"!=sr(new tr(new ArrayBuffer(1)))||Ie&&"[object Map]"!=sr(new Ie)||rr&&"[object Promise]"!=sr(rr.resolve())||nr&&"[object Set]"!=sr(new nr)||or&&"[object WeakMap]"!=sr(new or))&&(sr=function(e){var t=E(e),r="[object Object]"==t?e.constructor:void 0,n=r?L(r):"";if(n)switch(n){case ar:return"[object DataView]";case ir:return"[object Map]";case ur:return"[object Promise]";case cr:return"[object Set]";case fr:return"[object WeakMap]"}return t});var lr=sr,pr=1,vr="[object Arguments]",dr="[object Array]",hr="[object Object]",yr=Object.prototype.hasOwnProperty;var br=function(e,t,r,n,o,a){var i=oe(e),u=oe(t),c=i?dr:lr(e),f=u?dr:lr(t),s=(c=c==vr?hr:c)==hr,l=(f=f==vr?hr:f)==hr,p=c==f;if(p&&ie(e)){if(!ie(t))return!1;i=!0,s=!1}if(p&&!s)return a||(a=new dt),i||be(e)?Dt(e,t,r,n,o,a):It(e,t,c,r,n,o,a);if(!(r&pr)){var v=s&&yr.call(e,"__wrapped__"),d=l&&yr.call(t,"__wrapped__");if(v||d){var h=v?e.value():e,y=d?t.value():t;return a||(a=new dt),o(h,y,r,n,a)}}return!!p&&(a||(a=new dt),er(e,t,r,n,o,a))};var _r=function e(t,r,n,o,a){return t===r||(null==t||null==r||!Q(t)&&!Q(r)?t!=t&&r!=r:br(t,r,n,o,e,a))},gr=1,mr=2;var jr=function(e,t,r,n){var o=r.length,a=o,i=!n;if(null==e)return!a;for(e=Object(e);o--;){var u=r[o];if(i&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++o<a;){var c=(u=r[o])[0],f=e[c],s=u[1];if(i&&u[2]){if(void 0===f&&!(c in e))return!1}else{var l=new dt;if(n)var p=n(f,s,c,e,t,l);if(!(void 0===p?_r(s,f,gr|mr,n,l):p))return!1}}return!0};var Or=function(e){return e==e&&!R(e)};var wr=function(e){for(var t=Se(e),r=t.length;r--;){var n=t[r],o=e[n];t[r]=[n,o,Or(o)]}return t};var Dr=function(e,t){return function(r){return null!=r&&r[e]===t&&(void 0!==t||e in Object(r))}};var Er=function(e){var t=wr(e);return 1==t.length&&t[0][2]?Dr(t[0][0],t[0][1]):function(r){return r===e||jr(r,e,t)}},Rr="[object Symbol]";var Sr=function(e){return"symbol"==typeof e||Q(e)&&E(e)==Rr},Pr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,kr=/^\w*$/;var xr=function(e,t){if(oe(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!Sr(e))||kr.test(e)||!Pr.test(e)||null!=t&&e in Object(t)},Nr="Expected a function";function Tr(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(Nr);var r=function(){var n=arguments,o=t?t.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var i=e.apply(this,n);return r.cache=a.set(o,i)||a,i};return r.cache=new(Tr.Cache||st),r}Tr.Cache=st;var Ar=Tr,Cr=500;var Yr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,zr=/\\(\\)?/g,Lr=function(e){var t=Ar(e,function(e){return r.size===Cr&&r.clear(),e}),r=t.cache;return t}(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Yr,function(e,r,n,o){t.push(n?o.replace(zr,"$1"):r||e)}),t});var Wr=function(e,t){for(var r=-1,n=null==e?0:e.length,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o},$r=1/0,Fr=d?d.prototype:void 0,Mr=Fr?Fr.toString:void 0;var Hr=function e(t){if("string"==typeof t)return t;if(oe(t))return Wr(t,e)+"";if(Sr(t))return Mr?Mr.call(t):"";var r=t+"";return"0"==r&&1/t==-$r?"-0":r};var Ir=function(e){return null==e?"":Hr(e)};var Ur=function(e,t){return oe(e)?e:xr(e,t)?[e]:Lr(Ir(e))},Vr=1/0;var Br=function(e){if("string"==typeof e||Sr(e))return e;var t=e+"";return"0"==t&&1/e==-Vr?"-0":t};var qr=function(e,t){for(var r=0,n=(t=Ur(t,e)).length;null!=e&&r<n;)e=e[Br(t[r++])];return r&&r==n?e:void 0};var Gr=function(e,t,r){var n=null==e?void 0:qr(e,t);return void 0===n?r:n};var Jr=function(e,t){return null!=e&&t in Object(e)};var Kr=function(e,t,r){for(var n=-1,o=(t=Ur(t,e)).length,a=!1;++n<o;){var i=Br(t[n]);if(!(a=null!=e&&r(e,i)))break;e=e[i]}return a||++n!=o?a:!!(o=null==e?0:e.length)&&le(o)&&fe(i,o)&&(oe(e)||ne(e))};var Qr=function(e,t){return null!=e&&Kr(e,t,Jr)},Xr=1,Zr=2;var en=function(e,t){return xr(e)&&Or(t)?Dr(Br(e),t):function(r){var n=Gr(r,e);return void 0===n&&n===t?Qr(r,e):_r(t,n,Xr|Zr)}};var tn=function(e){return e};var rn=function(e){return function(t){return null==t?void 0:t[e]}};var nn=function(e){return function(t){return qr(t,e)}};var on=function(e){return xr(e)?rn(Br(e)):nn(e)};var an=function(e){return"function"==typeof e?e:null==e?tn:"object"==typeof e?oe(e)?en(e[0],e[1]):Er(e):on(e)};var un,cn=function(e,t){var r={};return t=an(t),Pe(e,function(e,n,o){G(r,n,t(e,n,o))}),r},fn={different:"different",deepEquals:"deepEquals",date:"date",regex:"regex",reactElement:"reactElement",function:"function"},sn="function"==typeof Symbol&&Symbol.for,ln=sn?Symbol.for("react.memo"):60115,pn=sn?Symbol.for("react.forward_ref"):60112,vn="http://bit.ly/wdyr02",dn="http://bit.ly/wdyr3",hn=(t(un={},fn.different,"different objects."),t(un,fn.deepEquals,"different objects that are equal by value."),t(un,fn.date,"different date objects with the same value."),t(un,fn.regex,"different regular expressions with the same value."),t(un,fn.reactElement,"different React elements with the same displayName."),t(un,fn.function,"different functions with the same name."),un),yn=!1;function bn(e){var r=e.Component,n=e.displayName,o=e.hookName,a=e.prefixMessage,i=e.diffObjType,u=e.differences,c=e.values,f=e.options;u&&u.length>0?(f.consoleLog(t({},n,r),"".concat(a," of ").concat(i," changes:")),u.forEach(function(e){var r=e.pathString,n=e.diffType,a=e.prevValue,u=e.nextValue;f.consoleGroup("%c".concat("hook"===i?"[hook ".concat(o," result]"):"".concat(i,"."),"%c").concat(r,"%c"),"color:".concat(f.diffNameColor,";"),"color:".concat(f.diffPathColor,";"),"color:default;"),f.consoleLog("".concat(hn[n]," (more info at ").concat(o?dn:vn,")")),f.consoleLog(t({},"prev ".concat(r),a),"!==",t({},"next ".concat(r),u)),f.consoleGroupEnd()})):u&&(f.consoleLog(t({},n,r),"".concat(a," the ").concat(i," object itself changed but its values are all equal."),"props"===i?"This could have been avoided by making the component pure, or by preventing its father from re-rendering.":"This usually means this component called setState when no changes in its state actually occurred.","More info at ".concat(vn)),f.consoleLog("prev ".concat(i,":"),c.prev," !== ",c.next,":next ".concat(i)))}function _n(e){var r=e.Component,n=e.displayName,o=e.hookName,a=e.prevProps,i=e.prevState,u=e.prevHook,c=e.nextProps,f=e.nextState,s=e.nextHook,l=e.reason,p=e.options;if(function(e,t,r){return!(yn||!r.logOnDifferentValues&&(!t.whyDidYouRender||!t.whyDidYouRender.logOnDifferentValues)&&(e.propsDifferences&&e.propsDifferences.some(function(e){return e.diffType===fn.different})||e.stateDifferences&&e.stateDifferences.some(function(e){return e.diffType===fn.different})||e.hookDifferences&&e.hookDifferences.some(function(e){return e.diffType===fn.different})))}(l,r,p)){p.consoleGroup("%c".concat(n),"color: ".concat(p.titleColor,";"));var v="Re-rendered because";l.propsDifferences&&(bn({Component:r,displayName:n,prefixMessage:v,diffObjType:"props",differences:l.propsDifferences,values:{prev:a,next:c},options:p}),v="And because"),l.stateDifferences&&bn({Component:r,displayName:n,prefixMessage:v,diffObjType:"state",differences:l.stateDifferences,values:{prev:i,next:f},options:p}),l.hookDifferences&&bn({Component:r,displayName:n,prefixMessage:v,diffObjType:"hook",differences:l.hookDifferences,values:{prev:u,next:s},hookName:o,options:p}),l.propsDifferences||l.stateDifferences||l.hookDifferences||p.consoleLog(t({},n,r),"Re-rendered although props and state objects are the same.","This usually means there was a call to this.forceUpdate() inside the component.","more info at ".concat(vn)),p.consoleGroupEnd()}}var gn=function(){};function mn(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=console.group,o=console.groupEnd;return t.collapseGroups?r=console.groupCollapsed:t.onlyLogs&&(r=console.log,o=gn),n({include:null,exclude:null,notifier:t.notifier||((e="hotReloadBufferMs"in t?t.hotReloadBufferMs:500)&&module&&module.hot&&module.hot.addStatusHandler&&module.hot.addStatusHandler(function(t){"idle"===t&&(yn=!0,setTimeout(function(){yn=!1},e))}),_n),onlyLogs:!1,consoleLog:console.log,consoleGroup:r,consoleGroupEnd:o,logOnDifferentValues:!1,trackHooks:!0,titleColor:"#058",diffNameColor:"blue",diffPathColor:"red"},t)}var jn="[object String]";var On=function(e){return"string"==typeof e||!oe(e)&&Q(e)&&E(e)==jn};function wn(e){return e.displayName||e.name||e.type&&wn(e.type)||e.render&&wn(e.render)||(On(e)?e:void 0)}var Dn=function(e,t,r,n){var o=-1,a=null==e?0:e.length;for(n&&a&&(r=e[++o]);++o<a;)r=t(r,e[o],o,e);return r};var En=function(e,t){return function(r,n){if(null==r)return r;if(!Re(r))return e(r,n);for(var o=r.length,a=t?o:-1,i=Object(r);(t?a--:++a<o)&&!1!==n(i[a],a,i););return r}}(Pe);var Rn=function(e,t,r,n,o){return o(e,function(e,o,a){r=n?(n=!1,e):t(r,e,o,a)}),r};var Sn=function(e,t,r){var n=oe(e)?Dn:Rn,o=arguments.length<3;return n(e,an(t),r,o,En)},Pn=Object.prototype.hasOwnProperty;var kn=function(e,t){return null!=e&&Pn.call(e,t)};var xn=function(e,t){return null!=e&&Kr(e,t,kn)},Nn="[object RegExp]";var Tn=function(e){return Q(e)&&E(e)==Nn},An=he&&he.isRegExp,Cn=An?de(An):Tn,Yn="[object Date]";var zn=function(e){return Q(e)&&E(e)==Yn},Ln=he&&he.isDate,Wn=Ln?de(Ln):zn,$n=Oe(Object.getPrototypeOf,Object),Fn="[object Object]",Mn=Function.prototype,Hn=Object.prototype,In=Mn.toString,Un=Hn.hasOwnProperty,Vn=In.call(Object);var Bn=function(e){if(!Q(e)||E(e)!=Fn)return!1;var t=$n(e);if(null===t)return!0;var r=Un.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&In.call(r)==Vn},qn="undefined"!=typeof Element,Gn="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103,Jn=function(e){return e.$$typeof===Gn};function Kn(e,t,r,n,o){return r.push({diffType:o,pathString:n,prevValue:e,nextValue:t}),o!==fn.different}function Qn(e,t,r){try{var n=[];return function e(t,r,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";if(t===r)return!0;if(!t||!r)return Kn(t,r,n,o,fn.different);if(oe(t)&&oe(r)){var a=t.length;if(a!==r.length)return Kn(t,r,n,o,fn.different);for(var i=!0,u=a;0!=u--;)e(t[u],r[u],n,"".concat(o,"[").concat(u,"]"))||(i=!1);return Kn(t,r,n,o,i?fn.deepEquals:fn.different)}if(Wn(t)&&Wn(r))return t.getTime()===r.getTime()?Kn(t,r,n,o,fn.date):Kn(t,r,n,o,fn.different);if(Cn(t)&&Cn(r))return t.toString()===r.toString()?Kn(t,r,n,o,fn.regex):Kn(t,r,n,o,fn.different);if(qn&&t instanceof Element&&r instanceof Element)return Kn(t,r,n,o,fn.different);if(Jn(t)&&Jn(r))return t.type!==r.type?Kn(t,r,n,o,fn.different):Kn(t,r,n,o,e(t.props,r.props,n,"".concat(o,".props"))?fn.reactElement:fn.different);if(T(t)&&T(r))return t.name===r.name?Kn(t,r,n,o,fn.function):Kn(t,r,n,o,fn.different);if(Bn(t)&&Bn(r)){var c=Se(t),f=c.length;if(f!==Se(r).length)return Kn(t,r,n,o,fn.different);for(var s=f;0!=s--;)if(!xn(r,c[s]))return Kn(t,r,n,o,fn.different);for(var l=!0,p=f;0!=p--;){var v=c[p];e(t[v],r[v],n,"".concat(o,".").concat(v))||(l=!1)}return Kn(t,r,n,o,l?fn.deepEquals:fn.different)}return Kn(t,r,n,o,fn.different)}(e,t,n,r),n}catch(e){if(e.message&&e.message.match(/stack|recursion/i)||-2146828260===e.number)return console.warn("Warning: why-did-you-render couldn't handle circular references in props.",e.name,e.message),!1;throw e}}var Xn={};function Zn(e,t){var r=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).shallow;if(e===t)return!1;if(!(void 0===r||r))return Qn(e,t);var o=e||Xn,a=t||Xn,i=Object.keys(n({},o,{},a));return Sn(i,function(e,t){var r=Qn(o[t],a[t],t);return r&&(e=[].concat(c(e),c(r))),e},[])}function eo(e,t,r,n,o,a){return{propsDifferences:Zn(e,n),stateDifferences:Zn(t,o),hookDifferences:Zn(r,a,{shallow:!1})}}function to(e){var t=e.Component,r=e.displayName,n=e.hookName,o=e.prevProps,a=e.prevState,i=e.prevHook,u=e.nextProps,c=e.nextState,f=e.nextHook;return{Component:t,displayName:r,hookName:n,prevProps:o,prevState:a,prevHook:i,nextProps:u,nextState:c,nextHook:f,options:e.options,reason:eo(o,a,i,u,c,f)}}function ro(e,t,r){return!function(e,t){return t.exclude&&t.exclude.length>0&&t.exclude.some(function(t){return t.test(e)})}(t,r)&&!(!e.whyDidYouRender&&!function(e,t){return t.include&&t.include.length>0&&t.include.some(function(t){return t.test(e)})}(t,r))}var no=function(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)},oo=Math.max;var ao=function(e,t,r){return t=oo(void 0===t?e.length-1:t,0),function(){for(var n=arguments,o=-1,a=oo(n.length-t,0),i=Array(a);++o<a;)i[o]=n[t+o];o=-1;for(var u=Array(t+1);++o<t;)u[o]=n[o];return u[t]=r(i),no(e,this,u)}};var io=function(e){return function(){return e}},uo=q?function(e,t){return q(e,"toString",{configurable:!0,enumerable:!1,value:io(t),writable:!0})}:tn,co=800,fo=16,so=Date.now;var lo=function(e){var t=0,r=0;return function(){var n=so(),o=fo-(n-r);if(r=n,o>0){if(++t>=co)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(uo);var po=function(e,t){return lo(ao(e,t,tn),e+"")};var vo=function(e,t,r){if(!R(r))return!1;var n=typeof t;return!!("number"==n?Re(r)&&fe(t,r.length):"string"==n&&t in r)&&xe(r[t],e)};var ho=function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t},yo=Object.prototype.hasOwnProperty;var bo=function(e){if(!R(e))return ho(e);var t=je(e),r=[];for(var n in e)("constructor"!=n||!t&&yo.call(e,n))&&r.push(n);return r};var _o=function(e){return Re(e)?ge(e,!0):bo(e)},go=Object.prototype,mo=go.hasOwnProperty,jo=po(function(e,t){e=Object(e);var r=-1,n=t.length,o=n>2?t[2]:void 0;for(o&&vo(t[0],t[1],o)&&(n=1);++r<n;)for(var a=t[r],i=_o(a),u=-1,c=i.length;++u<c;){var f=i[u],s=e[f];(void 0===s||xe(s,go[f])&&!mo.call(e,f))&&(e[f]=a[f])}return e}),Oo=1;function wo(t,r,n,c){var f=function(n){function f(e,r){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,f),(n=function(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?i(e):t}(this,o(f).call(this,e,r)))._WDYR={renderNumber:0};var a=u(o(f.prototype),"render",i(n))||n.render;return a!==t.prototype.render&&(n.render=function(){return f.prototype.render.apply(i(n)),a()}),n}var s,l,p;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&a(e,t)}(f,t),s=f,(l=[{key:"render",value:function(){return this._WDYR.renderNumber++,"isStrictMode"in this._WDYR||(this._WDYR.isStrictMode=function(e){for(var t=e._reactInternalFiber;null!==t;){if(t.mode&Oo)return!0;t=t.return}return!1}(this)),this._WDYR.isStrictMode&&this._WDYR.renderNumber%2==1||(this._WDYR.prevProps&&c.notifier(to({Component:t,displayName:r,prevProps:this._WDYR.prevProps,prevState:this._WDYR.prevState,nextProps:this.props,nextState:this.state,options:c})),this._WDYR.prevProps=this.props,this._WDYR.prevState=this.state),u(o(f.prototype),"render",this)?u(o(f.prototype),"render",this).call(this):null}}])&&e(s.prototype,l),p&&e(s,p),f}();return f.displayName=r,jo(f,t),f}function Do(e,t,r,n,o){var a=t.path,i=r,u=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner.current;if(!u)return i;var c=u.type.ComponentForHooksTracking||u.type,f=wn(c);if(!ro(c,f,o))return i;var s=n.useRef(),l=s.current;if(s.current=i,l){var p=to({Component:c,displayName:f,hookName:e,prevHook:a?Gr(l,a):l,nextHook:a?Gr(i,a):i,options:o});p.reason.hookDifferences&&o.notifier(p)}return s.current}function Eo(e,t,r,n,o){return t.$$typeof===ln?function(e,t,r,n){var o=e.type,a=o.$$typeof===pn,i=a?o.render:o;function u(){var o=arguments[0],a=r.useRef(),u=a.current;if(a.current=o,u){var c=to({Component:e,displayName:t,prevProps:u,nextProps:o,options:n});c.reason.propsDifferences&&c.reason.propsDifferences.length>0&&n.notifier(c)}return i.apply(void 0,arguments)}u.displayName=wn(i),u.ComponentForHooksTracking=e,jo(u,i);var c=r.memo(a?r.forwardRef(u):u,e.compare);return c.displayName=t,jo(c,e),c}(t,r,n,o):t.$$typeof===pn?function(e,t,r,n){var o=e.render,a=o.$$typeof===ln,i=a?o.type:o;function u(){var o=arguments[0],a=r.useRef(),u=a.current;if(a.current=o,u){var c=to({Component:e,displayName:t,prevProps:u,nextProps:o,options:n});c.reason.propsDifferences&&c.reason.propsDifferences.length>0&&n.notifier(c)}return i.apply(void 0,arguments)}u.displayName=wn(i),u.ComponentForHooksTracking=i,jo(u,i);var c=r.forwardRef(a?r.memo(u,o.compare):u);return c.displayName=t,jo(c,e),c}(t,r,n,o):t.prototype&&t.prototype.isReactComponent?wo(t,r,0,o):function(e,t,r,n){function o(o){var a=r.useRef(),i=a.current;if(a.current=o,i){var u=to({Component:e,displayName:t,prevProps:i,nextProps:o,options:n});u.reason.propsDifferences&&n.notifier(u)}return e(o)}return o.displayName=t,o.ComponentForHooksTracking=e,jo(o,e),o}(t,r,n,o)}function Ro(e,t,r,n,o){if(e.has(t))return e.get(t);var a=Eo(0,t,r,n,o);return e.set(t,a),a}var So={useState:{path:"0"},useReducer:{path:"0"},useContext:!0,useMemo:!0};function Po(e,t){var r,o=mn(t),a=e.createElement,i=e.createFactory,u=new WeakMap;if(e.createElement=function(t){for(var r=null,n=null,i=null,c=arguments.length,f=new Array(c>1?c-1:0),s=1;s<c;s++)f[s-1]=arguments[s];try{if(r=("function"==typeof t||t.$$typeof===ln||t.$$typeof===pn)&&ro(t,wn(t),o))return n=t&&t.whyDidYouRender&&t.whyDidYouRender.customName||wn(t),i=Ro(u,t,n,e,o),a.apply(e,[i].concat(f))}catch(e){o.consoleLog("whyDidYouRender error. Please file a bug at https://github.com/welldone-software/why-did-you-render/issues.",{errorInfo:{error:e,componentNameOrComponent:t,rest:f,options:o,isShouldTrack:r,displayName:n,WDYRPatchedComponent:i}})}return a.apply(e,[t].concat(f))},Object.assign(e.createElement,a),e.createFactory=function(t){var r=e.createElement.bind(null,t);return r.type=t,r},Object.assign(e.createFactory,i),o.trackHooks){var c=cn(So,function(t,n){return function(){var a=r[n];if(!a)throw new Error("[WhyDidYouRender] A problem with React Hooks patching occurred.");var i=a.apply(void 0,arguments);return t&&Do(n,!0===t?{}:t,i,e,o),i}});Object.defineProperty(e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher,"current",{set:function(e){r=e&&n({},e,{},e.origHooks)},get:function(){return r&&n({},r,{},c,{origHooks:r})}})}return e.__REVERT_WHY_DID_YOU_RENDER__=function(){Object.assign(e,{createElement:a,createFactory:i}),u=null,Object.defineProperty(e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher,"current",{writable:!0,value:r}),delete e.__REVERT_WHY_DID_YOU_RENDER__},e}return Po.defaultNotifier=_n,Po}); | ||
//# sourceMappingURL=whyDidYouRender.min.js.map |
{ | ||
"name": "@welldone-software/why-did-you-render", | ||
"version": "3.3.2", | ||
"version": "3.3.3", | ||
"description": "Monkey patches React to notify you about avoidable re-renders.", | ||
"types": "types.d.ts", | ||
"main": "dist/cjs/whyDidYouRender.min.js", | ||
"types": "src/whyDidYouRender.d.ts", | ||
"module": "dist/esm/whyDidYouRender.min.js", | ||
@@ -14,3 +14,4 @@ "browser": "dist/umd/whyDidYouRender.min.js", | ||
"src", | ||
"dist" | ||
"dist", | ||
"types.d.ts" | ||
], | ||
@@ -37,3 +38,6 @@ "scripts": { | ||
"jest": { | ||
"cacheDirectory": ".cache/jest-cache" | ||
"cacheDirectory": ".cache/jest-cache", | ||
"setupFilesAfterEnv": [ | ||
"<rootDir>/jestSetup.js" | ||
] | ||
}, | ||
@@ -53,5 +57,5 @@ "dependencies": { | ||
"@testing-library/jest-dom": "^4.0.0", | ||
"@testing-library/react": "^8.0.9", | ||
"@types/react": "^16.9.0", | ||
"acorn-walk": "^6.2.0", | ||
"@testing-library/react": "^9.1.1", | ||
"@types/react": "^16.9.1", | ||
"acorn-walk": "^7.0.0", | ||
"astring": "^1.4.1", | ||
@@ -66,3 +70,3 @@ "babel-core": "^7.0.0-bridge.0", | ||
"eslint": "^6.1.0", | ||
"eslint-plugin-jest": "^22.15.0", | ||
"eslint-plugin-jest": "^22.15.1", | ||
"eslint-plugin-react": "^7.14.3", | ||
@@ -77,5 +81,5 @@ "eslint-watch": "^6.0.0", | ||
"nollup": "^0.6.3", | ||
"react": "^16.8.6", | ||
"react-dom": "npm:@hot-loader/react-dom@^16.8.6", | ||
"react-hot-loader": "^4.12.10", | ||
"react": "^16.9.0", | ||
"react-dom": "npm:@hot-loader/react-dom@^16.9.0", | ||
"react-hot-loader": "^4.12.11", | ||
"react-redux": "^7.1.0", | ||
@@ -88,3 +92,3 @@ "redux": "^4.0.4", | ||
"rollup-plugin-commonjs-alternate": "^0.0.6", | ||
"rollup-plugin-license": "^0.11.0", | ||
"rollup-plugin-license": "^0.12.0", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
@@ -91,0 +95,0 @@ "rollup-plugin-replace": "^2.2.0", |
@@ -5,497 +5,495 @@ import React from 'react' | ||
describe('calculateDeepEqualDiffs', () => { | ||
test('same', () => { | ||
const prevValue = {a: 'b'} | ||
const nextValue = prevValue | ||
test('same', () => { | ||
const prevValue = {a: 'b'} | ||
const nextValue = prevValue | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
expect(diffs).toEqual([]) | ||
}) | ||
expect(diffs).toEqual([]) | ||
}) | ||
test('not deep equal', () => { | ||
const prevValue = {a: 'b'} | ||
const nextValue = {a: 'c'} | ||
test('not deep equal', () => { | ||
const prevValue = {a: 'b'} | ||
const nextValue = {a: 'c'} | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
expect(diffs).toEqual([ | ||
{ | ||
pathString: '.a', | ||
prevValue: 'b', | ||
nextValue: 'c', | ||
diffType: diffTypes.different | ||
}, | ||
{ | ||
pathString: '', | ||
prevValue, | ||
nextValue, | ||
diffType: diffTypes.different | ||
} | ||
]) | ||
}) | ||
expect(diffs).toEqual([ | ||
{ | ||
pathString: '.a', | ||
prevValue: 'b', | ||
nextValue: 'c', | ||
diffType: diffTypes.different | ||
}, | ||
{ | ||
pathString: '', | ||
prevValue, | ||
nextValue, | ||
diffType: diffTypes.different | ||
} | ||
]) | ||
}) | ||
test('simple deep', () => { | ||
const prevValue = {a: 'b'} | ||
const nextValue = {a: 'b'} | ||
test('simple deep', () => { | ||
const prevValue = {a: 'b'} | ||
const nextValue = {a: 'b'} | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
expect(diffs).toEqual([ | ||
{ | ||
pathString: '', | ||
prevValue, | ||
nextValue, | ||
diffType: diffTypes.deepEquals | ||
} | ||
]) | ||
}) | ||
expect(diffs).toEqual([ | ||
{ | ||
pathString: '', | ||
prevValue, | ||
nextValue, | ||
diffType: diffTypes.deepEquals | ||
} | ||
]) | ||
}) | ||
test('nested object deep equals', () => { | ||
const prevValue = {a: {b: 'c'}} | ||
const nextValue = {a: {b: 'c'}} | ||
test('nested object deep equals', () => { | ||
const prevValue = {a: {b: 'c'}} | ||
const nextValue = {a: {b: 'c'}} | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
expect(diffs).toEqual([ | ||
{ | ||
pathString: '.a', | ||
prevValue: prevValue.a, | ||
nextValue: nextValue.a, | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '', | ||
prevValue, | ||
nextValue, | ||
diffType: diffTypes.deepEquals | ||
} | ||
]) | ||
}) | ||
expect(diffs).toEqual([ | ||
{ | ||
pathString: '.a', | ||
prevValue: prevValue.a, | ||
nextValue: nextValue.a, | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '', | ||
prevValue, | ||
nextValue, | ||
diffType: diffTypes.deepEquals | ||
} | ||
]) | ||
}) | ||
test('nested array deep equals', () => { | ||
const prevValue = {a: {b: ['c']}} | ||
const nextValue = {a: {b: ['c']}} | ||
test('nested array deep equals', () => { | ||
const prevValue = {a: {b: ['c']}} | ||
const nextValue = {a: {b: ['c']}} | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
expect(diffs).toEqual([ | ||
{ | ||
pathString: '.a.b', | ||
prevValue: prevValue.a.b, | ||
nextValue: nextValue.a.b, | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '.a', | ||
prevValue: prevValue.a, | ||
nextValue: nextValue.a, | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '', | ||
prevValue, | ||
nextValue, | ||
diffType: diffTypes.deepEquals | ||
} | ||
]) | ||
}) | ||
expect(diffs).toEqual([ | ||
{ | ||
pathString: '.a.b', | ||
prevValue: prevValue.a.b, | ||
nextValue: nextValue.a.b, | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '.a', | ||
prevValue: prevValue.a, | ||
nextValue: nextValue.a, | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '', | ||
prevValue, | ||
nextValue, | ||
diffType: diffTypes.deepEquals | ||
} | ||
]) | ||
}) | ||
test('date', () => { | ||
const now = new Date() | ||
const now2 = new Date(now) | ||
test('date', () => { | ||
const now = new Date() | ||
const now2 = new Date(now) | ||
const prevValue = {a: {b: [now]}} | ||
const nextValue = {a: {b: [now2]}} | ||
const prevValue = {a: {b: [now]}} | ||
const nextValue = {a: {b: [now2]}} | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
expect(diffs).toEqual([ | ||
{ | ||
pathString: '.a.b[0]', | ||
prevValue: prevValue.a.b[0], | ||
nextValue: nextValue.a.b[0], | ||
diffType: diffTypes.date | ||
}, | ||
{ | ||
pathString: '.a.b', | ||
prevValue: prevValue.a.b, | ||
nextValue: nextValue.a.b, | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '.a', | ||
prevValue: prevValue.a, | ||
nextValue: nextValue.a, | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '', | ||
prevValue, | ||
nextValue, | ||
diffType: diffTypes.deepEquals | ||
} | ||
]) | ||
}) | ||
expect(diffs).toEqual([ | ||
{ | ||
pathString: '.a.b[0]', | ||
prevValue: prevValue.a.b[0], | ||
nextValue: nextValue.a.b[0], | ||
diffType: diffTypes.date | ||
}, | ||
{ | ||
pathString: '.a.b', | ||
prevValue: prevValue.a.b, | ||
nextValue: nextValue.a.b, | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '.a', | ||
prevValue: prevValue.a, | ||
nextValue: nextValue.a, | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '', | ||
prevValue, | ||
nextValue, | ||
diffType: diffTypes.deepEquals | ||
} | ||
]) | ||
}) | ||
test('regular expression', () => { | ||
const regEx = /c/i | ||
const regEx2 = /c/i | ||
test('regular expression', () => { | ||
const regEx = /c/i | ||
const regEx2 = /c/i | ||
const prevValue = {a: {b: [regEx]}} | ||
const nextValue = {a: {b: [regEx2]}} | ||
const prevValue = {a: {b: [regEx]}} | ||
const nextValue = {a: {b: [regEx2]}} | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
expect(diffs).toEqual([ | ||
{ | ||
pathString: '.a.b[0]', | ||
prevValue: prevValue.a.b[0], | ||
nextValue: nextValue.a.b[0], | ||
diffType: diffTypes.regex | ||
}, | ||
{ | ||
pathString: '.a.b', | ||
prevValue: prevValue.a.b, | ||
nextValue: nextValue.a.b, | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '.a', | ||
prevValue: prevValue.a, | ||
nextValue: nextValue.a, | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '', | ||
prevValue, | ||
nextValue, | ||
diffType: diffTypes.deepEquals | ||
} | ||
]) | ||
}) | ||
expect(diffs).toEqual([ | ||
{ | ||
pathString: '.a.b[0]', | ||
prevValue: prevValue.a.b[0], | ||
nextValue: nextValue.a.b[0], | ||
diffType: diffTypes.regex | ||
}, | ||
{ | ||
pathString: '.a.b', | ||
prevValue: prevValue.a.b, | ||
nextValue: nextValue.a.b, | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '.a', | ||
prevValue: prevValue.a, | ||
nextValue: nextValue.a, | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '', | ||
prevValue, | ||
nextValue, | ||
diffType: diffTypes.deepEquals | ||
} | ||
]) | ||
}) | ||
test('dom elements', () => { | ||
const element = document.createElement('div') | ||
const element2 = document.createElement('div') | ||
test('dom elements', () => { | ||
const element = document.createElement('div') | ||
const element2 = document.createElement('div') | ||
const prevValue = {a: element} | ||
const nextValue = {a: element2} | ||
const prevValue = {a: element} | ||
const nextValue = {a: element2} | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
expect(diffs).toEqual([ | ||
{ | ||
pathString: '.a', | ||
prevValue: prevValue.a, | ||
nextValue: nextValue.a, | ||
diffType: diffTypes.different | ||
}, | ||
{ | ||
pathString: '', | ||
prevValue, | ||
nextValue, | ||
diffType: diffTypes.different | ||
} | ||
]) | ||
}) | ||
expect(diffs).toEqual([ | ||
{ | ||
pathString: '.a', | ||
prevValue: prevValue.a, | ||
nextValue: nextValue.a, | ||
diffType: diffTypes.different | ||
}, | ||
{ | ||
pathString: '', | ||
prevValue, | ||
nextValue, | ||
diffType: diffTypes.different | ||
} | ||
]) | ||
}) | ||
test('equal react elements', () => { | ||
const tooltip = <div>hi!</div> | ||
test('equal react elements', () => { | ||
const tooltip = <div>hi!</div> | ||
const prevValue = {a: tooltip} | ||
const nextValue = {a: tooltip} | ||
const prevValue = {a: tooltip} | ||
const nextValue = {a: tooltip} | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
expect(diffs).toEqual([ | ||
{ | ||
pathString: '', | ||
prevValue, | ||
nextValue, | ||
diffType: diffTypes.deepEquals | ||
} | ||
]) | ||
}) | ||
expect(diffs).toEqual([ | ||
{ | ||
pathString: '', | ||
prevValue, | ||
nextValue, | ||
diffType: diffTypes.deepEquals | ||
} | ||
]) | ||
}) | ||
test('simple react elements', () => { | ||
const tooltip = <div>hi!</div> | ||
const tooltip2 = <div>hi!</div> | ||
test('simple react elements', () => { | ||
const tooltip = <div>hi!</div> | ||
const tooltip2 = <div>hi!</div> | ||
const prevValue = {a: tooltip} | ||
const nextValue = {a: tooltip2} | ||
const prevValue = {a: tooltip} | ||
const nextValue = {a: tooltip2} | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
expect(diffs).toEqual([ | ||
{ | ||
pathString: '.a.props', | ||
prevValue: {children: 'hi!'}, | ||
nextValue: {children: 'hi!'}, | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '.a', | ||
prevValue: prevValue.a, | ||
nextValue: nextValue.a, | ||
diffType: diffTypes.reactElement | ||
}, | ||
{ | ||
pathString: '', | ||
prevValue, | ||
nextValue, | ||
diffType: diffTypes.deepEquals | ||
} | ||
]) | ||
}) | ||
expect(diffs).toEqual([ | ||
{ | ||
pathString: '.a.props', | ||
prevValue: {children: 'hi!'}, | ||
nextValue: {children: 'hi!'}, | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '.a', | ||
prevValue: prevValue.a, | ||
nextValue: nextValue.a, | ||
diffType: diffTypes.reactElement | ||
}, | ||
{ | ||
pathString: '', | ||
prevValue, | ||
nextValue, | ||
diffType: diffTypes.deepEquals | ||
} | ||
]) | ||
}) | ||
test('react class component instance', () => { | ||
class MyComponent extends React.Component{ | ||
render(){ | ||
return <div>hi!</div> | ||
} | ||
test('react class component instance', () => { | ||
class MyComponent extends React.Component{ | ||
render(){ | ||
return <div>hi!</div> | ||
} | ||
} | ||
const tooltip = <MyComponent/> | ||
const tooltip2 = <MyComponent/> | ||
const tooltip = <MyComponent/> | ||
const tooltip2 = <MyComponent/> | ||
const prevValue = {a: tooltip} | ||
const nextValue = {a: tooltip2} | ||
const prevValue = {a: tooltip} | ||
const nextValue = {a: tooltip2} | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
expect(diffs).toEqual([ | ||
{ | ||
pathString: '.a.props', | ||
prevValue: {}, | ||
nextValue: {}, | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '.a', | ||
prevValue: prevValue.a, | ||
nextValue: nextValue.a, | ||
diffType: diffTypes.reactElement | ||
}, | ||
{ | ||
pathString: '', | ||
prevValue, | ||
nextValue, | ||
diffType: diffTypes.deepEquals | ||
} | ||
]) | ||
}) | ||
expect(diffs).toEqual([ | ||
{ | ||
pathString: '.a.props', | ||
prevValue: {}, | ||
nextValue: {}, | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '.a', | ||
prevValue: prevValue.a, | ||
nextValue: nextValue.a, | ||
diffType: diffTypes.reactElement | ||
}, | ||
{ | ||
pathString: '', | ||
prevValue, | ||
nextValue, | ||
diffType: diffTypes.deepEquals | ||
} | ||
]) | ||
}) | ||
test('react class pure component instance', () => { | ||
class MyComponent extends React.PureComponent{ | ||
render(){ | ||
return <div>hi!</div> | ||
} | ||
test('react class pure component instance', () => { | ||
class MyComponent extends React.PureComponent{ | ||
render(){ | ||
return <div>hi!</div> | ||
} | ||
} | ||
const tooltip = <MyComponent/> | ||
const tooltip2 = <MyComponent/> | ||
const tooltip = <MyComponent/> | ||
const tooltip2 = <MyComponent/> | ||
const prevValue = {a: tooltip} | ||
const nextValue = {a: tooltip2} | ||
const prevValue = {a: tooltip} | ||
const nextValue = {a: tooltip2} | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
expect(diffs).toEqual([ | ||
{ | ||
pathString: '.a.props', | ||
prevValue: {}, | ||
nextValue: {}, | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '.a', | ||
prevValue: prevValue.a, | ||
nextValue: nextValue.a, | ||
diffType: diffTypes.reactElement | ||
}, | ||
{ | ||
pathString: '', | ||
prevValue, | ||
nextValue, | ||
diffType: diffTypes.deepEquals | ||
} | ||
]) | ||
}) | ||
expect(diffs).toEqual([ | ||
{ | ||
pathString: '.a.props', | ||
prevValue: {}, | ||
nextValue: {}, | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '.a', | ||
prevValue: prevValue.a, | ||
nextValue: nextValue.a, | ||
diffType: diffTypes.reactElement | ||
}, | ||
{ | ||
pathString: '', | ||
prevValue, | ||
nextValue, | ||
diffType: diffTypes.deepEquals | ||
} | ||
]) | ||
}) | ||
test('react functional component instance', () => { | ||
const MyFunctionalComponent = () => ( | ||
<div>hi!</div> | ||
) | ||
test('react functional component instance', () => { | ||
const MyFunctionalComponent = () => ( | ||
<div>hi!</div> | ||
) | ||
const tooltip = <MyFunctionalComponent/> | ||
const tooltip2 = <MyFunctionalComponent/> | ||
const tooltip = <MyFunctionalComponent/> | ||
const tooltip2 = <MyFunctionalComponent/> | ||
const prevValue = {a: tooltip} | ||
const nextValue = {a: tooltip2} | ||
const prevValue = {a: tooltip} | ||
const nextValue = {a: tooltip2} | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
expect(diffs).toEqual([ | ||
{ | ||
pathString: '.a.props', | ||
prevValue: {}, | ||
nextValue: {}, | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '.a', | ||
prevValue: prevValue.a, | ||
nextValue: nextValue.a, | ||
diffType: diffTypes.reactElement | ||
}, | ||
{ | ||
pathString: '', | ||
prevValue, | ||
nextValue, | ||
diffType: diffTypes.deepEquals | ||
} | ||
]) | ||
}) | ||
expect(diffs).toEqual([ | ||
{ | ||
pathString: '.a.props', | ||
prevValue: {}, | ||
nextValue: {}, | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '.a', | ||
prevValue: prevValue.a, | ||
nextValue: nextValue.a, | ||
diffType: diffTypes.reactElement | ||
}, | ||
{ | ||
pathString: '', | ||
prevValue, | ||
nextValue, | ||
diffType: diffTypes.deepEquals | ||
} | ||
]) | ||
}) | ||
test('react memoized functional component instance', () => { | ||
const MyFunctionalComponent = React.memo(() => ( | ||
<div>hi!</div> | ||
)) | ||
test('react memoized functional component instance', () => { | ||
const MyFunctionalComponent = React.memo(() => ( | ||
<div>hi!</div> | ||
)) | ||
const tooltip = <MyFunctionalComponent a={1}/> | ||
const tooltip2 = <MyFunctionalComponent a={1}/> | ||
const tooltip = <MyFunctionalComponent a={1}/> | ||
const tooltip2 = <MyFunctionalComponent a={1}/> | ||
const prevValue = {a: tooltip} | ||
const nextValue = {a: tooltip2} | ||
const prevValue = {a: tooltip} | ||
const nextValue = {a: tooltip2} | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
expect(diffs).toEqual([ | ||
{ | ||
pathString: '.a.props', | ||
prevValue: {a: 1}, | ||
nextValue: {a: 1}, | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '.a', | ||
prevValue: prevValue.a, | ||
nextValue: nextValue.a, | ||
diffType: diffTypes.reactElement | ||
}, | ||
{ | ||
pathString: '', | ||
prevValue, | ||
nextValue, | ||
diffType: diffTypes.deepEquals | ||
} | ||
]) | ||
}) | ||
expect(diffs).toEqual([ | ||
{ | ||
pathString: '.a.props', | ||
prevValue: {a: 1}, | ||
nextValue: {a: 1}, | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '.a', | ||
prevValue: prevValue.a, | ||
nextValue: nextValue.a, | ||
diffType: diffTypes.reactElement | ||
}, | ||
{ | ||
pathString: '', | ||
prevValue, | ||
nextValue, | ||
diffType: diffTypes.deepEquals | ||
} | ||
]) | ||
}) | ||
test('functions', () => { | ||
const fn = function something(){} | ||
const fn2 = function something(){} | ||
test('functions', () => { | ||
const fn = function something(){} | ||
const fn2 = function something(){} | ||
const prevValue = {fn} | ||
const nextValue = {fn: fn2} | ||
const prevValue = {fn} | ||
const nextValue = {fn: fn2} | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
expect(diffs).toEqual([ | ||
{ | ||
pathString: '.fn', | ||
prevValue: prevValue.fn, | ||
nextValue: nextValue.fn, | ||
diffType: diffTypes.function | ||
}, | ||
{ | ||
pathString: '', | ||
prevValue, | ||
nextValue, | ||
diffType: diffTypes.deepEquals | ||
} | ||
]) | ||
}) | ||
expect(diffs).toEqual([ | ||
{ | ||
pathString: '.fn', | ||
prevValue: prevValue.fn, | ||
nextValue: nextValue.fn, | ||
diffType: diffTypes.function | ||
}, | ||
{ | ||
pathString: '', | ||
prevValue, | ||
nextValue, | ||
diffType: diffTypes.deepEquals | ||
} | ||
]) | ||
}) | ||
test('inline functions', () => { | ||
const prevValue = {a: {fn: () => {}}} | ||
const nextValue = {a: {fn: () => {}}} | ||
test('inline functions', () => { | ||
const prevValue = {a: {fn: () => {}}} | ||
const nextValue = {a: {fn: () => {}}} | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
expect(diffs).toEqual([ | ||
{ | ||
pathString: '.a.fn', | ||
prevValue: prevValue.a.fn, | ||
nextValue: nextValue.a.fn, | ||
diffType: diffTypes.function | ||
}, | ||
{ | ||
pathString: '.a', | ||
prevValue: prevValue.a, | ||
nextValue: nextValue.a, | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '', | ||
prevValue, | ||
nextValue, | ||
diffType: diffTypes.deepEquals | ||
} | ||
]) | ||
}) | ||
expect(diffs).toEqual([ | ||
{ | ||
pathString: '.a.fn', | ||
prevValue: prevValue.a.fn, | ||
nextValue: nextValue.a.fn, | ||
diffType: diffTypes.function | ||
}, | ||
{ | ||
pathString: '.a', | ||
prevValue: prevValue.a, | ||
nextValue: nextValue.a, | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '', | ||
prevValue, | ||
nextValue, | ||
diffType: diffTypes.deepEquals | ||
} | ||
]) | ||
}) | ||
test('mix', () => { | ||
const prevValue = {a: {fn: () => {}}, b: [{tooltip: <div>hi</div>}]} | ||
const nextValue = {a: {fn: () => {}}, b: [{tooltip: <div>hi</div>}]} | ||
test('mix', () => { | ||
const prevValue = {a: {fn: () => {}}, b: [{tooltip: <div>hi</div>}]} | ||
const nextValue = {a: {fn: () => {}}, b: [{tooltip: <div>hi</div>}]} | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
const diffs = calculateDeepEqualDiffs(prevValue, nextValue) | ||
expect(diffs).toEqual([ | ||
{ | ||
pathString: '.b[0].tooltip.props', | ||
prevValue: {children: 'hi'}, | ||
nextValue: {children: 'hi'}, | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '.b[0].tooltip', | ||
prevValue: prevValue.b[0].tooltip, | ||
nextValue: nextValue.b[0].tooltip, | ||
diffType: diffTypes.reactElement | ||
}, | ||
{ | ||
pathString: '.b[0]', | ||
prevValue: prevValue.b[0], | ||
nextValue: nextValue.b[0], | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '.b', | ||
prevValue: prevValue.b, | ||
nextValue: nextValue.b, | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '.a.fn', | ||
prevValue: prevValue.a.fn, | ||
nextValue: nextValue.a.fn, | ||
diffType: diffTypes.function | ||
}, | ||
{ | ||
pathString: '.a', | ||
prevValue: prevValue.a, | ||
nextValue: nextValue.a, | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '', | ||
prevValue, | ||
nextValue, | ||
diffType: diffTypes.deepEquals | ||
} | ||
]) | ||
}) | ||
expect(diffs).toEqual([ | ||
{ | ||
pathString: '.b[0].tooltip.props', | ||
prevValue: {children: 'hi'}, | ||
nextValue: {children: 'hi'}, | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '.b[0].tooltip', | ||
prevValue: prevValue.b[0].tooltip, | ||
nextValue: nextValue.b[0].tooltip, | ||
diffType: diffTypes.reactElement | ||
}, | ||
{ | ||
pathString: '.b[0]', | ||
prevValue: prevValue.b[0], | ||
nextValue: nextValue.b[0], | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '.b', | ||
prevValue: prevValue.b, | ||
nextValue: nextValue.b, | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '.a.fn', | ||
prevValue: prevValue.a.fn, | ||
nextValue: nextValue.a.fn, | ||
diffType: diffTypes.function | ||
}, | ||
{ | ||
pathString: '.a', | ||
prevValue: prevValue.a, | ||
nextValue: nextValue.a, | ||
diffType: diffTypes.deepEquals | ||
}, | ||
{ | ||
pathString: '', | ||
prevValue, | ||
nextValue, | ||
diffType: diffTypes.deepEquals | ||
} | ||
]) | ||
}) |
@@ -1,2 +0,1 @@ | ||
/* eslint-disable no-console */ | ||
import React from 'react' | ||
@@ -95,219 +94,174 @@ | ||
function expectLogTypes(expectedLogTypes, expects){ | ||
expect(console.log) | ||
.toHaveBeenCalledTimes(calculateNumberOfExpectedLogs(expectedLogTypes, expects.logsCount)) | ||
const consoleOutputs = flushConsoleOutput() | ||
expect(console.group) | ||
.toHaveBeenCalledTimes(calculateNumberOfExpectedLogs(expectedLogTypes, expects.groupLogsCount)) | ||
expect(consoleOutputs.filter(o => o.level === 'log')) | ||
.toHaveLength(calculateNumberOfExpectedLogs(expectedLogTypes, expects.logsCount)) | ||
expect(console.groupCollapsed) | ||
.toHaveBeenCalledTimes(calculateNumberOfExpectedLogs(expectedLogTypes, expects.groupCollapsedLogsCount)) | ||
expect(consoleOutputs.filter(o => o.level === 'group')) | ||
.toHaveLength(calculateNumberOfExpectedLogs(expectedLogTypes, expects.groupLogsCount)) | ||
expect(consoleOutputs.filter(o => o.level === 'groupCollapsed')) | ||
.toHaveLength(calculateNumberOfExpectedLogs(expectedLogTypes, expects.groupCollapsedLogsCount)) | ||
} | ||
describe('defaultNotifier', () => { | ||
describe('For no differences', () => { | ||
Object.values(testInputAndExpects).forEach(({description, userOptions, expects}) => { | ||
test(description, () => { | ||
const updateInfo = getUpdateInfo({ | ||
Component: TestComponent, | ||
prevProps: null, | ||
prevState: null, | ||
nextProps: null, | ||
nextState: null, | ||
options: normalizeOptions(userOptions) | ||
}) | ||
beforeEach(() => { | ||
console.log = jest.fn() | ||
console.group = jest.fn() | ||
console.groupCollapsed = jest.fn() | ||
}) | ||
defaultNotifier(updateInfo) | ||
describe('For no differences', () => { | ||
Object.values(testInputAndExpects).forEach(({description, userOptions, expects}) => { | ||
test(description, () => { | ||
const updateInfo = getUpdateInfo({ | ||
Component: TestComponent, | ||
prevProps: null, | ||
prevState: null, | ||
nextProps: null, | ||
nextState: null, | ||
options: normalizeOptions(userOptions) | ||
}) | ||
defaultNotifier(updateInfo) | ||
expectLogTypes(['title', 'emptyValues'], expects) | ||
}) | ||
expectLogTypes(['title', 'emptyValues'], expects) | ||
}) | ||
}) | ||
}) | ||
describe('For different props eq by ref', () => { | ||
Object.values(testInputAndExpects).forEach(({description, userOptions, expects}) => { | ||
test(description, () => { | ||
const updateInfo = getUpdateInfo({ | ||
Component: TestComponent, | ||
prevProps: {a: 'aa'}, | ||
prevState: null, | ||
nextProps: {a: 'aa'}, | ||
nextState: null, | ||
options: normalizeOptions(userOptions) | ||
}) | ||
describe('For different props eq by ref', () => { | ||
Object.values(testInputAndExpects).forEach(({description, userOptions, expects}) => { | ||
test(description, () => { | ||
const updateInfo = getUpdateInfo({ | ||
Component: TestComponent, | ||
prevProps: {a: 'aa'}, | ||
prevState: null, | ||
nextProps: {a: 'aa'}, | ||
nextState: null, | ||
options: normalizeOptions(userOptions) | ||
}) | ||
defaultNotifier(updateInfo) | ||
defaultNotifier(updateInfo) | ||
expectLogTypes(['title', 'changedObjects'], expects) | ||
}) | ||
expectLogTypes(['title', 'changedObjects'], expects) | ||
}) | ||
}) | ||
}) | ||
describe('For equal state eq by ref', () => { | ||
Object.values(testInputAndExpects).forEach(({description, userOptions, expects}) => { | ||
test(description, () => { | ||
const updateInfo = getUpdateInfo({ | ||
Component: TestComponent, | ||
prevProps: null, | ||
prevState: {a: 'aa'}, | ||
nextProps: null, | ||
nextState: {a: 'aa'}, | ||
options: normalizeOptions(userOptions) | ||
}) | ||
describe('For equal state eq by ref', () => { | ||
Object.values(testInputAndExpects).forEach(({description, userOptions, expects}) => { | ||
test(description, () => { | ||
const updateInfo = getUpdateInfo({ | ||
Component: TestComponent, | ||
prevProps: null, | ||
prevState: {a: 'aa'}, | ||
nextProps: null, | ||
nextState: {a: 'aa'}, | ||
options: normalizeOptions(userOptions) | ||
}) | ||
defaultNotifier(updateInfo) | ||
defaultNotifier(updateInfo) | ||
expectLogTypes(['title', 'changedObjects'], expects) | ||
}) | ||
expectLogTypes(['title', 'changedObjects'], expects) | ||
}) | ||
}) | ||
}) | ||
describe('For different state and props', () => { | ||
Object.values(testInputAndExpects).forEach(({description, userOptions, expects}) => { | ||
test(description, () => { | ||
const updateInfo = getUpdateInfo({ | ||
Component: TestComponent, | ||
prevProps: {a: 'aa'}, | ||
prevState: {a: 'aa'}, | ||
nextProps: {a: 'aa'}, | ||
nextState: {a: 'aa'}, | ||
options: normalizeOptions(userOptions) | ||
}) | ||
describe('For different state and props', () => { | ||
Object.values(testInputAndExpects).forEach(({description, userOptions, expects}) => { | ||
test(description, () => { | ||
const updateInfo = getUpdateInfo({ | ||
Component: TestComponent, | ||
prevProps: {a: 'aa'}, | ||
prevState: {a: 'aa'}, | ||
nextProps: {a: 'aa'}, | ||
nextState: {a: 'aa'}, | ||
options: normalizeOptions(userOptions) | ||
}) | ||
defaultNotifier(updateInfo) | ||
defaultNotifier(updateInfo) | ||
expectLogTypes(['title', 'changedObjects', 'changedObjects'], expects) | ||
}) | ||
expectLogTypes(['title', 'changedObjects', 'changedObjects'], expects) | ||
}) | ||
}) | ||
}) | ||
describe('For different hook', () => { | ||
Object.values(testInputAndExpects).forEach(({description, userOptions, expects}) => { | ||
test(description, () => { | ||
const updateInfo = getUpdateInfo({ | ||
Component: TestComponent, | ||
prevHook: {a: 'aa'}, | ||
nextHook: {a: 'aa'}, | ||
options: normalizeOptions(userOptions) | ||
}) | ||
describe('For different hook', () => { | ||
Object.values(testInputAndExpects).forEach(({description, userOptions, expects}) => { | ||
test(description, () => { | ||
const updateInfo = getUpdateInfo({ | ||
Component: TestComponent, | ||
prevHook: {a: 'aa'}, | ||
nextHook: {a: 'aa'}, | ||
options: normalizeOptions(userOptions) | ||
}) | ||
defaultNotifier(updateInfo) | ||
defaultNotifier(updateInfo) | ||
expectLogTypes(['title', 'changedObjectValues'], expects) | ||
}) | ||
expectLogTypes(['title', 'changedObjectValues'], expects) | ||
}) | ||
}) | ||
}) | ||
describe('For different deep equal props', () => { | ||
Object.values(testInputAndExpects).forEach(({description, userOptions, expects}) => { | ||
test(description, () => { | ||
const updateInfo = getUpdateInfo({ | ||
Component: TestComponent, | ||
prevProps: {a: {b: 'b'}}, | ||
prevState: null, | ||
nextProps: {a: {b: 'b'}}, | ||
nextState: null, | ||
options: normalizeOptions(userOptions) | ||
}) | ||
describe('For different deep equal props', () => { | ||
Object.values(testInputAndExpects).forEach(({description, userOptions, expects}) => { | ||
test(description, () => { | ||
const updateInfo = getUpdateInfo({ | ||
Component: TestComponent, | ||
prevProps: {a: {b: 'b'}}, | ||
prevState: null, | ||
nextProps: {a: {b: 'b'}}, | ||
nextState: null, | ||
options: normalizeOptions(userOptions) | ||
}) | ||
defaultNotifier(updateInfo) | ||
defaultNotifier(updateInfo) | ||
expectLogTypes(['title', 'changedObjectValues'], expects) | ||
}) | ||
expectLogTypes(['title', 'changedObjectValues'], expects) | ||
}) | ||
}) | ||
}) | ||
describe('For different deep equal state', () => { | ||
Object.values(testInputAndExpects).forEach(({description, userOptions, expects}) => { | ||
test(description, () => { | ||
const updateInfo = getUpdateInfo({ | ||
Component: TestComponent, | ||
prevProps: null, | ||
prevState: {a: {b: 'b'}}, | ||
nextProps: null, | ||
nextState: {a: {b: 'b'}}, | ||
options: normalizeOptions(userOptions) | ||
}) | ||
defaultNotifier(updateInfo) | ||
expectLogTypes(['title', 'changedObjectValues'], expects) | ||
describe('For different deep equal state', () => { | ||
Object.values(testInputAndExpects).forEach(({description, userOptions, expects}) => { | ||
test(description, () => { | ||
const updateInfo = getUpdateInfo({ | ||
Component: TestComponent, | ||
prevProps: null, | ||
prevState: {a: {b: 'b'}}, | ||
nextProps: null, | ||
nextState: {a: {b: 'b'}}, | ||
options: normalizeOptions(userOptions) | ||
}) | ||
}) | ||
}) | ||
describe('For different deep equal state and props', () => { | ||
Object.values(testInputAndExpects).forEach(({description, userOptions, expects}) => { | ||
test(description, () => { | ||
const updateInfo = getUpdateInfo({ | ||
Component: TestComponent, | ||
prevProps: {a: {b: 'b'}}, | ||
prevState: {a: {b: 'b'}}, | ||
nextProps: {a: {b: 'b'}}, | ||
nextState: {a: {b: 'b'}}, | ||
options: normalizeOptions(userOptions) | ||
}) | ||
defaultNotifier(updateInfo) | ||
defaultNotifier(updateInfo) | ||
expectLogTypes(['title', 'changedObjectValues', 'changedObjectValues'], expects) | ||
}) | ||
expectLogTypes(['title', 'changedObjectValues'], expects) | ||
}) | ||
}) | ||
}) | ||
describe('For different functions by the same name', () => { | ||
Object.values(testInputAndExpects).forEach(({description, userOptions, expects}) => { | ||
test(description, () => { | ||
const updateInfo = getUpdateInfo({ | ||
Component: TestComponent, | ||
prevProps: {fn: function something(){}}, | ||
prevState: null, | ||
nextProps: {fn: function something(){}}, | ||
nextState: null, | ||
options: normalizeOptions(userOptions) | ||
}) | ||
defaultNotifier(updateInfo) | ||
expectLogTypes(['title', 'changedObjectValues'], expects) | ||
describe('For different deep equal state and props', () => { | ||
Object.values(testInputAndExpects).forEach(({description, userOptions, expects}) => { | ||
test(description, () => { | ||
const updateInfo = getUpdateInfo({ | ||
Component: TestComponent, | ||
prevProps: {a: {b: 'b'}}, | ||
prevState: {a: {b: 'b'}}, | ||
nextProps: {a: {b: 'b'}}, | ||
nextState: {a: {b: 'b'}}, | ||
options: normalizeOptions(userOptions) | ||
}) | ||
}) | ||
}) | ||
describe('Mix of changes', () => { | ||
Object.values(testInputAndExpects).forEach(({description, userOptions, expects}) => { | ||
test(description, () => { | ||
const updateInfo = getUpdateInfo({ | ||
Component: TestComponent, | ||
prevProps: {fn: function something(){}}, | ||
prevState: {a: {b: 'b'}}, | ||
nextProps: {fn: function something(){}}, | ||
nextState: {a: {b: 'b'}}, | ||
options: normalizeOptions(userOptions) | ||
}) | ||
defaultNotifier(updateInfo) | ||
defaultNotifier(updateInfo) | ||
expectLogTypes(['title', 'changedObjectValues', 'changedObjectValues'], expects) | ||
}) | ||
expectLogTypes(['title', 'changedObjectValues', 'changedObjectValues'], expects) | ||
}) | ||
}) | ||
}) | ||
describe('logOnDifferentProps option', () => { | ||
test('For different props', () => { | ||
describe('For different functions by the same name', () => { | ||
Object.values(testInputAndExpects).forEach(({description, userOptions, expects}) => { | ||
test(description, () => { | ||
const updateInfo = getUpdateInfo({ | ||
Component: TestComponent, | ||
prevProps: {a: 'aaaa'}, | ||
prevProps: {fn: function something(){}}, | ||
prevState: null, | ||
nextProps: {a: 'bbbb'}, | ||
nextProps: {fn: function something(){}}, | ||
nextState: null, | ||
options: normalizeOptions({ | ||
onlyLogs: true | ||
}) | ||
options: normalizeOptions(userOptions) | ||
}) | ||
@@ -317,15 +271,17 @@ | ||
expect(console.log).not.toHaveBeenCalled() | ||
expectLogTypes(['title', 'changedObjectValues'], expects) | ||
}) | ||
}) | ||
}) | ||
test('For different state', () => { | ||
describe('Mix of changes', () => { | ||
Object.values(testInputAndExpects).forEach(({description, userOptions, expects}) => { | ||
test(description, () => { | ||
const updateInfo = getUpdateInfo({ | ||
Component: TestComponent, | ||
prevProps: null, | ||
prevState: {a: 'aaaa'}, | ||
nextProps: null, | ||
nextState: {a: 'bbbb'}, | ||
options: normalizeOptions({ | ||
onlyLogs: true | ||
}) | ||
prevProps: {fn: function something(){}}, | ||
prevState: {a: {b: 'b'}}, | ||
nextProps: {fn: function something(){}}, | ||
nextState: {a: {b: 'b'}}, | ||
options: normalizeOptions(userOptions) | ||
}) | ||
@@ -335,57 +291,97 @@ | ||
expect(console.log).not.toHaveBeenCalled() | ||
expectLogTypes(['title', 'changedObjectValues', 'changedObjectValues'], expects) | ||
}) | ||
}) | ||
}) | ||
test('For different props with logOnDifferentValues', () => { | ||
const updateInfo = getUpdateInfo({ | ||
Component: TestComponent, | ||
prevProps: {a: 'aaaa'}, | ||
prevState: null, | ||
nextProps: {a: 'bbbb'}, | ||
nextState: null, | ||
options: normalizeOptions({ | ||
logOnDifferentValues: true, | ||
onlyLogs: true | ||
}) | ||
describe('logOnDifferentProps option', () => { | ||
test('For different props', () => { | ||
const updateInfo = getUpdateInfo({ | ||
Component: TestComponent, | ||
prevProps: {a: 'aaaa'}, | ||
prevState: null, | ||
nextProps: {a: 'bbbb'}, | ||
nextState: null, | ||
options: normalizeOptions({ | ||
onlyLogs: true | ||
}) | ||
}) | ||
defaultNotifier(updateInfo) | ||
defaultNotifier(updateInfo) | ||
expect(console.log).toHaveBeenCalledTimes( | ||
calculateNumberOfExpectedLogs( | ||
['title', 'changedObjectValues'], | ||
testInputAndExpects.onlyLogs.expects.logsCount | ||
) | ||
) | ||
const consoleOutputs = flushConsoleOutput() | ||
expect(consoleOutputs).toHaveLength(0) | ||
}) | ||
test('For different state', () => { | ||
const updateInfo = getUpdateInfo({ | ||
Component: TestComponent, | ||
prevProps: null, | ||
prevState: {a: 'aaaa'}, | ||
nextProps: null, | ||
nextState: {a: 'bbbb'}, | ||
options: normalizeOptions({ | ||
onlyLogs: true | ||
}) | ||
}) | ||
test('For different props with logOnDifferentValues for a specific component', () => { | ||
class OwnTestComponent extends React.Component{ | ||
static whyDidYouRender = {logOnDifferentValues: true} | ||
render(){ | ||
return <div>hi!</div> | ||
} | ||
defaultNotifier(updateInfo) | ||
const consoleOutputs = flushConsoleOutput() | ||
expect(consoleOutputs).toHaveLength(0) | ||
}) | ||
test('For different props with logOnDifferentValues', () => { | ||
const updateInfo = getUpdateInfo({ | ||
Component: TestComponent, | ||
prevProps: {a: 'aaaa'}, | ||
prevState: null, | ||
nextProps: {a: 'bbbb'}, | ||
nextState: null, | ||
options: normalizeOptions({ | ||
logOnDifferentValues: true, | ||
onlyLogs: true | ||
}) | ||
}) | ||
defaultNotifier(updateInfo) | ||
const consoleOutputs = flushConsoleOutput() | ||
expect(consoleOutputs).toHaveLength( | ||
calculateNumberOfExpectedLogs( | ||
['title', 'changedObjectValues'], | ||
testInputAndExpects.onlyLogs.expects.logsCount | ||
) | ||
) | ||
}) | ||
test('For different props with logOnDifferentValues for a specific component', () => { | ||
class OwnTestComponent extends React.Component{ | ||
static whyDidYouRender = {logOnDifferentValues: true} | ||
render(){ | ||
return <div>hi!</div> | ||
} | ||
} | ||
const updateInfo = getUpdateInfo({ | ||
Component: OwnTestComponent, | ||
prevProps: {a: 'aaaa'}, | ||
prevState: null, | ||
nextProps: {a: 'bbbb'}, | ||
nextState: null, | ||
options: normalizeOptions({ | ||
onlyLogs: true | ||
}) | ||
const updateInfo = getUpdateInfo({ | ||
Component: OwnTestComponent, | ||
prevProps: {a: 'aaaa'}, | ||
prevState: null, | ||
nextProps: {a: 'bbbb'}, | ||
nextState: null, | ||
options: normalizeOptions({ | ||
onlyLogs: true | ||
}) | ||
}) | ||
defaultNotifier(updateInfo) | ||
defaultNotifier(updateInfo) | ||
expect(console.log).toHaveBeenCalledTimes( | ||
calculateNumberOfExpectedLogs( | ||
['title', 'changedObjectValues'], | ||
testInputAndExpects.onlyLogs.expects.logsCount | ||
) | ||
const consoleOutputs = flushConsoleOutput() | ||
expect(consoleOutputs).toHaveLength( | ||
calculateNumberOfExpectedLogs( | ||
['title', 'changedObjectValues'], | ||
testInputAndExpects.onlyLogs.expects.logsCount | ||
) | ||
}) | ||
) | ||
}) | ||
}) |
import React from 'react' | ||
import getDisplayName from './getDisplayName' | ||
describe('getDisplayName', () => { | ||
test('For a component', () => { | ||
class TestComponent extends React.Component{ | ||
render(){ | ||
return <div>hi!</div> | ||
} | ||
test('For a component', () => { | ||
class TestComponent extends React.Component{ | ||
render(){ | ||
return <div>hi!</div> | ||
} | ||
const displayName = getDisplayName(TestComponent) | ||
expect(displayName).toBe('TestComponent') | ||
}) | ||
} | ||
const displayName = getDisplayName(TestComponent) | ||
expect(displayName).toBe('TestComponent') | ||
}) | ||
test('For inline functions', () => { | ||
const InlineComponent = () => ( | ||
<div>hi!</div> | ||
) | ||
InlineComponent.displayName = 'InlineComponentCustomName' | ||
const displayName = getDisplayName(InlineComponent) | ||
expect(displayName).toBe('InlineComponentCustomName') | ||
}) | ||
test('For inline functions', () => { | ||
const InlineComponent = () => ( | ||
<div>hi!</div> | ||
) | ||
InlineComponent.displayName = 'InlineComponentCustomName' | ||
const displayName = getDisplayName(InlineComponent) | ||
expect(displayName).toBe('InlineComponentCustomName') | ||
}) | ||
test('For inline functions with no name', () => { | ||
const InlineComponent = () => ( | ||
<div>hi!</div> | ||
) | ||
const displayName = getDisplayName(InlineComponent) | ||
expect(displayName).toBe('InlineComponent') | ||
}) | ||
test('For inline functions with no name', () => { | ||
const InlineComponent = () => ( | ||
<div>hi!</div> | ||
) | ||
const displayName = getDisplayName(InlineComponent) | ||
expect(displayName).toBe('InlineComponent') | ||
}) |
@@ -13,449 +13,446 @@ import React from 'react' | ||
describe('getUpdateInfo', () => { | ||
test('Empty props and state', () => { | ||
test('Empty props and state', () => { | ||
const input = { | ||
Component: TestComponent, | ||
displayName: getDisplayName(TestComponent), | ||
prevProps: {}, | ||
prevState: null, | ||
nextProps: {}, | ||
nextState: null, | ||
options: normalizeOptions() | ||
} | ||
const input = { | ||
Component: TestComponent, | ||
displayName: getDisplayName(TestComponent), | ||
prevProps: {}, | ||
prevState: null, | ||
nextProps: {}, | ||
nextState: null, | ||
options: normalizeOptions() | ||
const updateInfo = getUpdateInfo(input) | ||
expect(updateInfo).toEqual({ | ||
...input, | ||
displayName: 'TestComponent', | ||
reason: { | ||
propsDifferences: [], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
} | ||
}) | ||
}) | ||
const updateInfo = getUpdateInfo(input) | ||
test('Same props', () => { | ||
const input = { | ||
Component: TestComponent, | ||
displayName: getDisplayName(TestComponent), | ||
prevProps: {a: 1}, | ||
prevState: null, | ||
nextProps: {a: 1}, | ||
nextState: null, | ||
options: normalizeOptions() | ||
} | ||
expect(updateInfo).toEqual({ | ||
...input, | ||
displayName: 'TestComponent', | ||
reason: { | ||
propsDifferences: [], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
} | ||
}) | ||
}) | ||
const updateInfo = getUpdateInfo(input) | ||
test('Same props', () => { | ||
const input = { | ||
Component: TestComponent, | ||
displayName: getDisplayName(TestComponent), | ||
prevProps: {a: 1}, | ||
prevState: null, | ||
nextProps: {a: 1}, | ||
nextState: null, | ||
options: normalizeOptions() | ||
expect(updateInfo).toEqual({ | ||
...input, | ||
displayName: 'TestComponent', | ||
reason: { | ||
propsDifferences: [], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
} | ||
}) | ||
}) | ||
const updateInfo = getUpdateInfo(input) | ||
test('Same state', () => { | ||
const input = { | ||
Component: TestComponent, | ||
displayName: getDisplayName(TestComponent), | ||
prevProps: {}, | ||
prevState: {a: 1}, | ||
nextProps: {}, | ||
nextState: {a: 1}, | ||
options: normalizeOptions() | ||
} | ||
expect(updateInfo).toEqual({ | ||
...input, | ||
displayName: 'TestComponent', | ||
reason: { | ||
propsDifferences: [], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
} | ||
}) | ||
}) | ||
const updateInfo = getUpdateInfo(input) | ||
test('Same state', () => { | ||
const input = { | ||
Component: TestComponent, | ||
displayName: getDisplayName(TestComponent), | ||
prevProps: {}, | ||
prevState: {a: 1}, | ||
nextProps: {}, | ||
nextState: {a: 1}, | ||
options: normalizeOptions() | ||
expect(updateInfo).toEqual({ | ||
...input, | ||
displayName: 'TestComponent', | ||
reason: { | ||
propsDifferences: [], | ||
stateDifferences: [], | ||
hookDifferences: false | ||
} | ||
}) | ||
}) | ||
const updateInfo = getUpdateInfo(input) | ||
test('Same props and state', () => { | ||
const input = { | ||
Component: TestComponent, | ||
displayName: getDisplayName(TestComponent), | ||
prevProps: {b: 1}, | ||
prevState: {a: 1}, | ||
nextProps: {b: 1}, | ||
nextState: {a: 1}, | ||
options: normalizeOptions() | ||
} | ||
expect(updateInfo).toEqual({ | ||
...input, | ||
displayName: 'TestComponent', | ||
reason: { | ||
propsDifferences: [], | ||
stateDifferences: [], | ||
hookDifferences: false | ||
} | ||
}) | ||
}) | ||
const updateInfo = getUpdateInfo(input) | ||
test('Same props and state', () => { | ||
const input = { | ||
Component: TestComponent, | ||
displayName: getDisplayName(TestComponent), | ||
prevProps: {b: 1}, | ||
prevState: {a: 1}, | ||
nextProps: {b: 1}, | ||
nextState: {a: 1}, | ||
options: normalizeOptions() | ||
expect(updateInfo).toEqual({ | ||
...input, | ||
displayName: 'TestComponent', | ||
reason: { | ||
propsDifferences: [], | ||
stateDifferences: [], | ||
hookDifferences: false | ||
} | ||
}) | ||
}) | ||
const updateInfo = getUpdateInfo(input) | ||
test('Props change', () => { | ||
const input = { | ||
Component: TestComponent, | ||
displayName: getDisplayName(TestComponent), | ||
prevProps: {a: 1}, | ||
prevState: null, | ||
nextProps: {a: 2}, | ||
nextState: null, | ||
options: normalizeOptions() | ||
} | ||
expect(updateInfo).toEqual({ | ||
...input, | ||
displayName: 'TestComponent', | ||
reason: { | ||
propsDifferences: [], | ||
stateDifferences: [], | ||
hookDifferences: false | ||
} | ||
}) | ||
}) | ||
const updateInfo = getUpdateInfo(input) | ||
test('Props change', () => { | ||
const input = { | ||
Component: TestComponent, | ||
displayName: getDisplayName(TestComponent), | ||
prevProps: {a: 1}, | ||
prevState: null, | ||
nextProps: {a: 2}, | ||
nextState: null, | ||
options: normalizeOptions() | ||
expect(updateInfo).toEqual({ | ||
...input, | ||
displayName: 'TestComponent', | ||
reason: { | ||
propsDifferences: [ | ||
{ | ||
pathString: 'a', | ||
diffType: diffTypes.different, | ||
prevValue: input.prevProps.a, | ||
nextValue: input.nextProps.a | ||
} | ||
], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
} | ||
}) | ||
}) | ||
const updateInfo = getUpdateInfo(input) | ||
test('State change', () => { | ||
const input = { | ||
Component: TestComponent, | ||
displayName: getDisplayName(TestComponent), | ||
prevProps: {}, | ||
prevState: {a: 1}, | ||
nextProps: {}, | ||
nextState: {a: 2}, | ||
options: normalizeOptions() | ||
} | ||
expect(updateInfo).toEqual({ | ||
...input, | ||
displayName: 'TestComponent', | ||
reason: { | ||
propsDifferences: [ | ||
{ | ||
pathString: 'a', | ||
diffType: diffTypes.different, | ||
prevValue: input.prevProps.a, | ||
nextValue: input.nextProps.a | ||
} | ||
], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
} | ||
}) | ||
}) | ||
const updateInfo = getUpdateInfo(input) | ||
test('State change', () => { | ||
const input = { | ||
Component: TestComponent, | ||
displayName: getDisplayName(TestComponent), | ||
prevProps: {}, | ||
prevState: {a: 1}, | ||
nextProps: {}, | ||
nextState: {a: 2}, | ||
options: normalizeOptions() | ||
expect(updateInfo).toEqual({ | ||
...input, | ||
displayName: 'TestComponent', | ||
reason: { | ||
propsDifferences: [], | ||
stateDifferences: [ | ||
{ | ||
pathString: 'a', | ||
diffType: diffTypes.different, | ||
prevValue: input.prevState.a, | ||
nextValue: input.nextState.a | ||
} | ||
], | ||
hookDifferences: false | ||
} | ||
}) | ||
}) | ||
const updateInfo = getUpdateInfo(input) | ||
test('Props and state change', () => { | ||
const input = { | ||
Component: TestComponent, | ||
displayName: getDisplayName(TestComponent), | ||
prevProps: {b: 1}, | ||
prevState: {a: 1}, | ||
nextProps: {b: 2}, | ||
nextState: {a: 2}, | ||
options: normalizeOptions() | ||
} | ||
expect(updateInfo).toEqual({ | ||
...input, | ||
displayName: 'TestComponent', | ||
reason: { | ||
propsDifferences: [], | ||
stateDifferences: [ | ||
{ | ||
pathString: 'a', | ||
diffType: diffTypes.different, | ||
prevValue: input.prevState.a, | ||
nextValue: input.nextState.a | ||
} | ||
], | ||
hookDifferences: false | ||
} | ||
}) | ||
}) | ||
const updateInfo = getUpdateInfo(input) | ||
test('Props and state change', () => { | ||
const input = { | ||
Component: TestComponent, | ||
displayName: getDisplayName(TestComponent), | ||
prevProps: {b: 1}, | ||
prevState: {a: 1}, | ||
nextProps: {b: 2}, | ||
nextState: {a: 2}, | ||
options: normalizeOptions() | ||
expect(updateInfo).toEqual({ | ||
...input, | ||
displayName: 'TestComponent', | ||
reason: { | ||
propsDifferences: [ | ||
{ | ||
pathString: 'b', | ||
diffType: diffTypes.different, | ||
prevValue: input.prevProps.b, | ||
nextValue: input.nextProps.b | ||
} | ||
], | ||
stateDifferences: [ | ||
{ | ||
pathString: 'a', | ||
diffType: diffTypes.different, | ||
prevValue: input.prevState.a, | ||
nextValue: input.nextState.a | ||
} | ||
], | ||
hookDifferences: false | ||
} | ||
}) | ||
}) | ||
const updateInfo = getUpdateInfo(input) | ||
test('Props change by ref', () => { | ||
const input = { | ||
Component: TestComponent, | ||
displayName: getDisplayName(TestComponent), | ||
prevProps: {a: {b: 'b'}}, | ||
prevState: null, | ||
nextProps: {a: {b: 'b'}}, | ||
nextState: null, | ||
options: normalizeOptions() | ||
} | ||
expect(updateInfo).toEqual({ | ||
...input, | ||
displayName: 'TestComponent', | ||
reason: { | ||
propsDifferences: [ | ||
{ | ||
pathString: 'b', | ||
diffType: diffTypes.different, | ||
prevValue: input.prevProps.b, | ||
nextValue: input.nextProps.b | ||
} | ||
], | ||
stateDifferences: [ | ||
{ | ||
pathString: 'a', | ||
diffType: diffTypes.different, | ||
prevValue: input.prevState.a, | ||
nextValue: input.nextState.a | ||
} | ||
], | ||
hookDifferences: false | ||
} | ||
}) | ||
}) | ||
const updateInfo = getUpdateInfo(input) | ||
test('Props change by ref', () => { | ||
const input = { | ||
Component: TestComponent, | ||
displayName: getDisplayName(TestComponent), | ||
prevProps: {a: {b: 'b'}}, | ||
prevState: null, | ||
nextProps: {a: {b: 'b'}}, | ||
nextState: null, | ||
options: normalizeOptions() | ||
expect(updateInfo).toEqual({ | ||
...input, | ||
displayName: 'TestComponent', | ||
reason: { | ||
propsDifferences: [ | ||
{ | ||
pathString: 'a', | ||
diffType: diffTypes.deepEquals, | ||
prevValue: input.prevProps.a, | ||
nextValue: input.nextProps.a | ||
} | ||
], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
} | ||
}) | ||
}) | ||
const updateInfo = getUpdateInfo(input) | ||
test('State changed by ref', () => { | ||
const input = { | ||
Component: TestComponent, | ||
displayName: getDisplayName(TestComponent), | ||
prevProps: {}, | ||
prevState: {a: {b: 'b'}}, | ||
nextProps: {}, | ||
nextState: {a: {b: 'b'}}, | ||
options: normalizeOptions() | ||
} | ||
expect(updateInfo).toEqual({ | ||
...input, | ||
displayName: 'TestComponent', | ||
reason: { | ||
propsDifferences: [ | ||
{ | ||
pathString: 'a', | ||
diffType: diffTypes.deepEquals, | ||
prevValue: input.prevProps.a, | ||
nextValue: input.nextProps.a | ||
} | ||
], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
} | ||
}) | ||
}) | ||
const updateInfo = getUpdateInfo(input) | ||
test('State changed by ref', () => { | ||
const input = { | ||
Component: TestComponent, | ||
displayName: getDisplayName(TestComponent), | ||
prevProps: {}, | ||
prevState: {a: {b: 'b'}}, | ||
nextProps: {}, | ||
nextState: {a: {b: 'b'}}, | ||
options: normalizeOptions() | ||
expect(updateInfo).toEqual({ | ||
...input, | ||
displayName: 'TestComponent', | ||
reason: { | ||
propsDifferences: [], | ||
stateDifferences: [ | ||
{ | ||
pathString: 'a', | ||
diffType: diffTypes.deepEquals, | ||
prevValue: input.prevState.a, | ||
nextValue: input.nextState.a | ||
} | ||
], | ||
hookDifferences: false | ||
} | ||
}) | ||
}) | ||
const updateInfo = getUpdateInfo(input) | ||
test('Props and state different by ref', () => { | ||
const input = { | ||
Component: TestComponent, | ||
displayName: getDisplayName(TestComponent), | ||
prevProps: {b: {c: 'c'}}, | ||
prevState: {a: {d: 'd'}}, | ||
nextProps: {b: {c: 'c'}}, | ||
nextState: {a: {d: 'd'}}, | ||
options: normalizeOptions() | ||
} | ||
expect(updateInfo).toEqual({ | ||
...input, | ||
displayName: 'TestComponent', | ||
reason: { | ||
propsDifferences: [], | ||
stateDifferences: [ | ||
{ | ||
pathString: 'a', | ||
diffType: diffTypes.deepEquals, | ||
prevValue: input.prevState.a, | ||
nextValue: input.nextState.a | ||
} | ||
], | ||
hookDifferences: false | ||
} | ||
}) | ||
}) | ||
const updateInfo = getUpdateInfo(input) | ||
test('Props and state different by ref', () => { | ||
const input = { | ||
Component: TestComponent, | ||
displayName: getDisplayName(TestComponent), | ||
prevProps: {b: {c: 'c'}}, | ||
prevState: {a: {d: 'd'}}, | ||
nextProps: {b: {c: 'c'}}, | ||
nextState: {a: {d: 'd'}}, | ||
options: normalizeOptions() | ||
expect(updateInfo).toEqual({ | ||
...input, | ||
displayName: 'TestComponent', | ||
reason: { | ||
propsDifferences: [ | ||
{ | ||
pathString: 'b', | ||
diffType: diffTypes.deepEquals, | ||
prevValue: input.prevProps.b, | ||
nextValue: input.nextProps.b | ||
} | ||
], | ||
stateDifferences: [ | ||
{ | ||
pathString: 'a', | ||
diffType: diffTypes.deepEquals, | ||
prevValue: input.prevState.a, | ||
nextValue: input.nextState.a | ||
} | ||
], | ||
hookDifferences: false | ||
} | ||
}) | ||
}) | ||
const updateInfo = getUpdateInfo(input) | ||
test('Props change by function', () => { | ||
const input = { | ||
Component: TestComponent, | ||
displayName: getDisplayName(TestComponent), | ||
prevProps: {a: () => {}}, | ||
prevState: null, | ||
nextProps: {a: () => {}}, | ||
nextState: null, | ||
options: normalizeOptions() | ||
} | ||
expect(updateInfo).toEqual({ | ||
...input, | ||
displayName: 'TestComponent', | ||
reason: { | ||
propsDifferences: [ | ||
{ | ||
pathString: 'b', | ||
diffType: diffTypes.deepEquals, | ||
prevValue: input.prevProps.b, | ||
nextValue: input.nextProps.b | ||
} | ||
], | ||
stateDifferences: [ | ||
{ | ||
pathString: 'a', | ||
diffType: diffTypes.deepEquals, | ||
prevValue: input.prevState.a, | ||
nextValue: input.nextState.a | ||
} | ||
], | ||
hookDifferences: false | ||
} | ||
}) | ||
}) | ||
const updateInfo = getUpdateInfo(input) | ||
test('Props change by function', () => { | ||
const input = { | ||
Component: TestComponent, | ||
displayName: getDisplayName(TestComponent), | ||
prevProps: {a: () => {}}, | ||
prevState: null, | ||
nextProps: {a: () => {}}, | ||
nextState: null, | ||
options: normalizeOptions() | ||
expect(updateInfo).toEqual({ | ||
...input, | ||
displayName: 'TestComponent', | ||
reason: { | ||
propsDifferences: [ | ||
{ | ||
pathString: 'a', | ||
diffType: diffTypes.function, | ||
prevValue: input.prevProps.a, | ||
nextValue: input.nextProps.a | ||
} | ||
], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
} | ||
}) | ||
}) | ||
const updateInfo = getUpdateInfo(input) | ||
test('State changed by function ref', () => { | ||
const input = { | ||
Component: TestComponent, | ||
displayName: getDisplayName(TestComponent), | ||
prevProps: {}, | ||
prevState: {a: () => {}}, | ||
nextProps: {}, | ||
nextState: {a: () => {}}, | ||
options: normalizeOptions() | ||
} | ||
expect(updateInfo).toEqual({ | ||
...input, | ||
displayName: 'TestComponent', | ||
reason: { | ||
propsDifferences: [ | ||
{ | ||
pathString: 'a', | ||
diffType: diffTypes.function, | ||
prevValue: input.prevProps.a, | ||
nextValue: input.nextProps.a | ||
} | ||
], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
} | ||
}) | ||
}) | ||
const updateInfo = getUpdateInfo(input) | ||
test('State changed by function ref', () => { | ||
const input = { | ||
Component: TestComponent, | ||
displayName: getDisplayName(TestComponent), | ||
prevProps: {}, | ||
prevState: {a: () => {}}, | ||
nextProps: {}, | ||
nextState: {a: () => {}}, | ||
options: normalizeOptions() | ||
expect(updateInfo).toEqual({ | ||
...input, | ||
displayName: 'TestComponent', | ||
reason: { | ||
propsDifferences: [], | ||
stateDifferences: [ | ||
{ | ||
pathString: 'a', | ||
diffType: diffTypes.function, | ||
prevValue: input.prevState.a, | ||
nextValue: input.nextState.a | ||
} | ||
], | ||
hookDifferences: false | ||
} | ||
}) | ||
}) | ||
const updateInfo = getUpdateInfo(input) | ||
test('Props and state different by function', () => { | ||
const input = { | ||
Component: TestComponent, | ||
displayName: getDisplayName(TestComponent), | ||
prevProps: {a: () => {}}, | ||
prevState: {b: () => {}}, | ||
nextProps: {a: () => {}}, | ||
nextState: {b: () => {}}, | ||
options: normalizeOptions() | ||
} | ||
expect(updateInfo).toEqual({ | ||
...input, | ||
displayName: 'TestComponent', | ||
reason: { | ||
propsDifferences: [], | ||
stateDifferences: [ | ||
{ | ||
pathString: 'a', | ||
diffType: diffTypes.function, | ||
prevValue: input.prevState.a, | ||
nextValue: input.nextState.a | ||
} | ||
], | ||
hookDifferences: false | ||
} | ||
}) | ||
}) | ||
const updateInfo = getUpdateInfo(input) | ||
test('Props and state different by function', () => { | ||
const input = { | ||
Component: TestComponent, | ||
displayName: getDisplayName(TestComponent), | ||
prevProps: {a: () => {}}, | ||
prevState: {b: () => {}}, | ||
nextProps: {a: () => {}}, | ||
nextState: {b: () => {}}, | ||
options: normalizeOptions() | ||
expect(updateInfo).toEqual({ | ||
...input, | ||
displayName: 'TestComponent', | ||
reason: { | ||
propsDifferences: [ | ||
{ | ||
pathString: 'a', | ||
diffType: diffTypes.function, | ||
prevValue: input.prevProps.a, | ||
nextValue: input.nextProps.a | ||
} | ||
], | ||
stateDifferences: [ | ||
{ | ||
pathString: 'b', | ||
diffType: diffTypes.function, | ||
prevValue: input.prevState.b, | ||
nextValue: input.nextState.b | ||
} | ||
], | ||
hookDifferences: false | ||
} | ||
}) | ||
}) | ||
const updateInfo = getUpdateInfo(input) | ||
test('Mix of differences', () => { | ||
const input = { | ||
Component: TestComponent, | ||
displayName: getDisplayName(TestComponent), | ||
prevProps: {a: () => {}, b: '123', c: {d: 'e'}, f: 3}, | ||
prevState: null, | ||
nextProps: {a: () => {}, b: '12345', c: {d: 'e'}, f: 3}, | ||
nextState: {a: 4}, | ||
options: normalizeOptions() | ||
} | ||
expect(updateInfo).toEqual({ | ||
...input, | ||
displayName: 'TestComponent', | ||
reason: { | ||
propsDifferences: [ | ||
{ | ||
pathString: 'a', | ||
diffType: diffTypes.function, | ||
prevValue: input.prevProps.a, | ||
nextValue: input.nextProps.a | ||
} | ||
], | ||
stateDifferences: [ | ||
{ | ||
pathString: 'b', | ||
diffType: diffTypes.function, | ||
prevValue: input.prevState.b, | ||
nextValue: input.nextState.b | ||
} | ||
], | ||
hookDifferences: false | ||
} | ||
}) | ||
}) | ||
const updateInfo = getUpdateInfo(input) | ||
test('Mix of differences', () => { | ||
const input = { | ||
Component: TestComponent, | ||
displayName: getDisplayName(TestComponent), | ||
prevProps: {a: () => {}, b: '123', c: {d: 'e'}, f: 3}, | ||
prevState: null, | ||
nextProps: {a: () => {}, b: '12345', c: {d: 'e'}, f: 3}, | ||
nextState: {a: 4}, | ||
options: normalizeOptions() | ||
expect(updateInfo).toEqual({ | ||
...input, | ||
displayName: 'TestComponent', | ||
reason: { | ||
propsDifferences: [ | ||
{ | ||
pathString: 'a', | ||
diffType: diffTypes.function, | ||
prevValue: input.prevProps.a, | ||
nextValue: input.nextProps.a | ||
}, | ||
{ | ||
pathString: 'b', | ||
diffType: diffTypes.different, | ||
prevValue: input.prevProps.b, | ||
nextValue: input.nextProps.b | ||
}, | ||
{ | ||
pathString: 'c', | ||
diffType: diffTypes.deepEquals, | ||
prevValue: input.prevProps.c, | ||
nextValue: input.nextProps.c | ||
} | ||
], | ||
stateDifferences: [ | ||
{ | ||
pathString: 'a', | ||
diffType: diffTypes.different, | ||
prevValue: undefined, | ||
nextValue: input.nextState.a | ||
} | ||
], | ||
hookDifferences: false | ||
} | ||
const updateInfo = getUpdateInfo(input) | ||
expect(updateInfo).toEqual({ | ||
...input, | ||
displayName: 'TestComponent', | ||
reason: { | ||
propsDifferences: [ | ||
{ | ||
pathString: 'a', | ||
diffType: diffTypes.function, | ||
prevValue: input.prevProps.a, | ||
nextValue: input.nextProps.a | ||
}, | ||
{ | ||
pathString: 'b', | ||
diffType: diffTypes.different, | ||
prevValue: input.prevProps.b, | ||
nextValue: input.nextProps.b | ||
}, | ||
{ | ||
pathString: 'c', | ||
diffType: diffTypes.deepEquals, | ||
prevValue: input.prevProps.c, | ||
nextValue: input.nextProps.c | ||
} | ||
], | ||
stateDifferences: [ | ||
{ | ||
pathString: 'a', | ||
diffType: diffTypes.different, | ||
prevValue: undefined, | ||
nextValue: input.nextState.a | ||
} | ||
], | ||
hookDifferences: false | ||
} | ||
}) | ||
}) | ||
}) |
@@ -6,3 +6,3 @@ import React, {useState, useLayoutEffect} from 'react' | ||
describe('hooks', () => { | ||
describe('hooks - simple', () => { | ||
let updateInfos = [] | ||
@@ -751,3 +751,2 @@ | ||
}) | ||
}) |
@@ -5,59 +5,54 @@ /* eslint-disable no-console */ | ||
import whyDidYouRender from './index' | ||
import errorOnConsoleOutput from './utils/errorOnConsoleOutput' | ||
describe('index', () => { | ||
const flushConsoleMessages = errorOnConsoleOutput() | ||
let updateInfos = [] | ||
beforeEach(() => { | ||
updateInfos = [] | ||
whyDidYouRender(React, { | ||
notifier: updateInfo => updateInfos.push(updateInfo) | ||
}) | ||
let updateInfos = [] | ||
beforeEach(() => { | ||
updateInfos = [] | ||
whyDidYouRender(React, { | ||
notifier: updateInfo => updateInfos.push(updateInfo) | ||
}) | ||
}) | ||
afterEach(() => { | ||
React.__REVERT_WHY_DID_YOU_RENDER__() | ||
}) | ||
afterEach(() => { | ||
React.__REVERT_WHY_DID_YOU_RENDER__() | ||
}) | ||
test('dont swallow errors', () => { | ||
const BrokenComponent = React.memo(null) | ||
BrokenComponent.whyDidYouRender = true | ||
test('dont swallow errors', () => { | ||
const BrokenComponent = React.memo(null) | ||
BrokenComponent.whyDidYouRender = true | ||
const mountBrokenComponent = () => { | ||
rtl.render( | ||
<BrokenComponent/> | ||
) | ||
} | ||
const mountBrokenComponent = () => { | ||
rtl.render( | ||
<BrokenComponent/> | ||
) | ||
} | ||
expect(mountBrokenComponent).toThrow('Cannot read property \'propTypes\' of null') | ||
expect(mountBrokenComponent).toThrow('Cannot read property \'propTypes\' of null') | ||
expect(flushConsoleMessages()).toEqual([ | ||
{ | ||
// console.error('Warning: memo: The first argument must be a component. Instead received: %s', 'null') | ||
level: 'error', | ||
args: expect.arrayContaining([ | ||
expect.stringContaining('Warning: memo: The first argument must be a component') | ||
]) | ||
}, | ||
{ | ||
level: 'log', | ||
args: expect.arrayContaining([ | ||
expect.stringContaining('whyDidYouRender error') | ||
]) | ||
}, | ||
{ | ||
level: 'error', | ||
args: expect.arrayContaining([ | ||
expect.stringContaining('propTypes') | ||
]) | ||
}, | ||
{ | ||
level: 'error', | ||
args: expect.arrayContaining([ | ||
expect.stringContaining('Consider adding an error boundary') | ||
]) | ||
} | ||
]) | ||
}) | ||
expect(global.flushConsoleOutput()).toEqual([ | ||
{ | ||
// console.error('Warning: memo: The first argument must be a component. Instead received: %s', 'null') | ||
level: 'error', | ||
args: expect.arrayContaining([ | ||
expect.stringContaining('Warning: memo: The first argument must be a component') | ||
]) | ||
}, | ||
{ | ||
level: 'log', | ||
args: expect.arrayContaining([ | ||
expect.stringContaining('whyDidYouRender error') | ||
]) | ||
}, | ||
{ | ||
level: 'error', | ||
args: expect.arrayContaining([ | ||
expect.stringContaining('propTypes') | ||
]) | ||
}, | ||
{ | ||
level: 'error', | ||
args: expect.arrayContaining([ | ||
expect.stringContaining('Consider adding an error boundary') | ||
]) | ||
} | ||
]) | ||
}) |
@@ -11,3 +11,3 @@ import React from 'react' | ||
describe('react-redux', () => { | ||
describe('react-redux - simple', () => { | ||
const initialState = {a: {b: 'c'}} | ||
@@ -14,0 +14,0 @@ |
@@ -7,139 +7,135 @@ /* eslint-disable no-console */ | ||
import {diffTypes} from '../consts' | ||
import errorOnConsoleOutput from '../utils/errorOnConsoleOutput' | ||
describe('styled-components', () => { | ||
errorOnConsoleOutput() | ||
let updateInfos = [] | ||
beforeEach(() => { | ||
updateInfos = [] | ||
whyDidYouRender(React, { | ||
notifier: updateInfo => updateInfos.push(updateInfo) | ||
}) | ||
let updateInfos = [] | ||
beforeEach(() => { | ||
updateInfos = [] | ||
whyDidYouRender(React, { | ||
notifier: updateInfo => updateInfos.push(updateInfo) | ||
}) | ||
}) | ||
afterEach(() => { | ||
React.__REVERT_WHY_DID_YOU_RENDER__() | ||
}) | ||
afterEach(() => { | ||
React.__REVERT_WHY_DID_YOU_RENDER__() | ||
}) | ||
test('simple styled-components', () => { | ||
const InnerComponent = () => <div>foobar</div> | ||
const StyledInnerComponent = styled(InnerComponent)`` | ||
test('simple styled-components', () => { | ||
const InnerComponent = () => <div>foobar</div> | ||
const StyledInnerComponent = styled(InnerComponent)`` | ||
StyledInnerComponent.whyDidYouRender = true | ||
StyledInnerComponent.whyDidYouRender = true | ||
const {rerender} = rtl.render( | ||
<StyledInnerComponent a={[]}/> | ||
) | ||
rerender( | ||
<StyledInnerComponent a={[]}/> | ||
) | ||
const {rerender} = rtl.render( | ||
<StyledInnerComponent a={[]}/> | ||
) | ||
rerender( | ||
<StyledInnerComponent a={[]}/> | ||
) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [{ | ||
pathString: 'a', | ||
diffType: diffTypes.deepEquals, | ||
prevValue: [], | ||
nextValue: [] | ||
}], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [{ | ||
pathString: 'a', | ||
diffType: diffTypes.deepEquals, | ||
prevValue: [], | ||
nextValue: [] | ||
}], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
}) | ||
test('styled-components wrap of a memoized component', () => { | ||
const InnerComponent = React.memo(() => <div>foobar</div>) | ||
const StyledInnerComponent = styled(InnerComponent)`` | ||
test('styled-components wrap of a memoized component', () => { | ||
const InnerComponent = React.memo(() => <div>foobar</div>) | ||
const StyledInnerComponent = styled(InnerComponent)`` | ||
StyledInnerComponent.whyDidYouRender = true | ||
StyledInnerComponent.whyDidYouRender = true | ||
const {rerender} = rtl.render( | ||
<StyledInnerComponent a={[]}/> | ||
) | ||
rerender( | ||
<StyledInnerComponent a={[]}/> | ||
) | ||
const {rerender} = rtl.render( | ||
<StyledInnerComponent a={[]}/> | ||
) | ||
rerender( | ||
<StyledInnerComponent a={[]}/> | ||
) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [{ | ||
pathString: 'a', | ||
diffType: diffTypes.deepEquals, | ||
prevValue: [], | ||
nextValue: [] | ||
}], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [{ | ||
pathString: 'a', | ||
diffType: diffTypes.deepEquals, | ||
prevValue: [], | ||
nextValue: [] | ||
}], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
}) | ||
test('styled-components with forward ref', () => { | ||
const InnerComponent = React.forwardRef((props, ref) => | ||
<div ref={ref}>foobar</div> | ||
) | ||
test('styled-components with forward ref', () => { | ||
const InnerComponent = React.forwardRef((props, ref) => | ||
<div ref={ref}>foobar</div> | ||
) | ||
const StyledInnerComponent = styled(InnerComponent)`` | ||
const StyledInnerComponent = styled(InnerComponent)`` | ||
StyledInnerComponent.whyDidYouRender = true | ||
StyledInnerComponent.whyDidYouRender = true | ||
const Wrapper = (props) => { | ||
const ref = React.useRef(null) | ||
return <StyledInnerComponent {...props} ref={ref} /> | ||
} | ||
const Wrapper = (props) => { | ||
const ref = React.useRef(null) | ||
return <StyledInnerComponent {...props} ref={ref} /> | ||
} | ||
const {rerender} = rtl.render( | ||
<Wrapper a={[]}/> | ||
) | ||
rerender( | ||
<Wrapper a={[]}/> | ||
) | ||
const {rerender} = rtl.render( | ||
<Wrapper a={[]}/> | ||
) | ||
rerender( | ||
<Wrapper a={[]}/> | ||
) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [{ | ||
pathString: 'a', | ||
diffType: diffTypes.deepEquals, | ||
prevValue: [], | ||
nextValue: [] | ||
}], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [{ | ||
pathString: 'a', | ||
diffType: diffTypes.deepEquals, | ||
prevValue: [], | ||
nextValue: [] | ||
}], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
}) | ||
test('styled-components with memoized forward ref', () => { | ||
const InnerComponent = React.memo( | ||
React.forwardRef((props, ref) => | ||
<div ref={ref}>foobar</div> | ||
) | ||
test('styled-components with memoized forward ref', () => { | ||
const InnerComponent = React.memo( | ||
React.forwardRef((props, ref) => | ||
<div ref={ref}>foobar</div> | ||
) | ||
) | ||
const StyledInnerComponent = styled(InnerComponent)`` | ||
const StyledInnerComponent = styled(InnerComponent)`` | ||
StyledInnerComponent.whyDidYouRender = true | ||
StyledInnerComponent.whyDidYouRender = true | ||
const Wrapper = (props) => { | ||
const ref = React.useRef(null) | ||
return <StyledInnerComponent {...props} ref={ref} /> | ||
} | ||
const Wrapper = (props) => { | ||
const ref = React.useRef(null) | ||
return <StyledInnerComponent {...props} ref={ref} /> | ||
} | ||
const {rerender} = rtl.render( | ||
<Wrapper a={[]}/> | ||
) | ||
rerender( | ||
<Wrapper a={[]}/> | ||
) | ||
const {rerender} = rtl.render( | ||
<Wrapper a={[]}/> | ||
) | ||
rerender( | ||
<Wrapper a={[]}/> | ||
) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [{ | ||
pathString: 'a', | ||
diffType: diffTypes.deepEquals, | ||
prevValue: [], | ||
nextValue: [] | ||
}], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [{ | ||
pathString: 'a', | ||
diffType: diffTypes.deepEquals, | ||
prevValue: [], | ||
nextValue: [] | ||
}], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
}) |
/* eslint-disable no-console */ | ||
import normalizeOptions from './normalizeOptions' | ||
describe('normalizeOptions', () => { | ||
test('Empty options works', () => { | ||
const options = normalizeOptions() | ||
expect(options.consoleLog).toBe(console.log) | ||
}) | ||
test('Empty options works', () => { | ||
const options = normalizeOptions() | ||
expect(options.consoleLog).toBe(console.log) | ||
}) | ||
test('User can rewrite options', () => { | ||
const ownNotifier = () => {} | ||
const userOptions = { | ||
notifier: ownNotifier | ||
} | ||
const options = normalizeOptions(userOptions) | ||
expect(options.notifier).toBe(ownNotifier) | ||
expect(options.consoleLog).toBe(console.log) | ||
}) | ||
test('User can rewrite options', () => { | ||
const ownNotifier = () => {} | ||
const userOptions = { | ||
notifier: ownNotifier | ||
} | ||
const options = normalizeOptions(userOptions) | ||
expect(options.notifier).toBe(ownNotifier) | ||
expect(options.consoleLog).toBe(console.log) | ||
}) |
@@ -7,3 +7,2 @@ /* eslint-disable no-console */ | ||
import {diffTypes} from '../consts' | ||
import errorOnConsoleOutput from '../utils/errorOnConsoleOutput' | ||
@@ -37,514 +36,509 @@ class TestComponent extends React.Component{ | ||
describe('patch class component', () => { | ||
errorOnConsoleOutput() | ||
let updateInfos = [] | ||
beforeEach(() => { | ||
updateInfos = [] | ||
whyDidYouRender(React, { | ||
notifier: updateInfo => updateInfos.push(updateInfo) | ||
}) | ||
let updateInfos = [] | ||
beforeEach(() => { | ||
updateInfos = [] | ||
whyDidYouRender(React, { | ||
notifier: updateInfo => updateInfos.push(updateInfo) | ||
}) | ||
}) | ||
afterEach(() => { | ||
React.__REVERT_WHY_DID_YOU_RENDER__() | ||
}) | ||
afterEach(() => { | ||
React.__REVERT_WHY_DID_YOU_RENDER__() | ||
}) | ||
test('Empty props and state', () => { | ||
const {rerender} = rtl.render( | ||
<TestComponent/> | ||
) | ||
rerender( | ||
<TestComponent/> | ||
) | ||
test('Empty props and state', () => { | ||
const {rerender} = rtl.render( | ||
<TestComponent/> | ||
) | ||
rerender( | ||
<TestComponent/> | ||
) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
}) | ||
test('Same props', () => { | ||
const {rerender} = rtl.render( | ||
<TestComponent a={1}/> | ||
) | ||
rerender( | ||
<TestComponent a={1}/> | ||
) | ||
test('Same props', () => { | ||
const {rerender} = rtl.render( | ||
<TestComponent a={1}/> | ||
) | ||
rerender( | ||
<TestComponent a={1}/> | ||
) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos).toHaveLength(1) | ||
}) | ||
test('Same state', () => { | ||
const StateTestComponent = createStateTestComponent({a: 1}, {a: 1}) | ||
rtl.render( | ||
<StateTestComponent/> | ||
) | ||
test('Same state', () => { | ||
const StateTestComponent = createStateTestComponent({a: 1}, {a: 1}) | ||
rtl.render( | ||
<StateTestComponent/> | ||
) | ||
return Promise.resolve() | ||
.then(() => { | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: false, | ||
stateDifferences: [], | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos).toHaveLength(1) | ||
return Promise.resolve() | ||
.then(() => { | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: false, | ||
stateDifferences: [], | ||
hookDifferences: false | ||
}) | ||
}) | ||
expect(updateInfos).toHaveLength(1) | ||
}) | ||
}) | ||
test('Props change', () => { | ||
const {rerender} = rtl.render( | ||
<TestComponent a={1}/> | ||
) | ||
rerender( | ||
<TestComponent a={2}/> | ||
) | ||
test('Props change', () => { | ||
const {rerender} = rtl.render( | ||
<TestComponent a={1}/> | ||
) | ||
rerender( | ||
<TestComponent a={2}/> | ||
) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [{ | ||
pathString: 'a', | ||
diffType: diffTypes.different, | ||
prevValue: 1, | ||
nextValue: 2 | ||
}], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [{ | ||
pathString: 'a', | ||
diffType: diffTypes.different, | ||
prevValue: 1, | ||
nextValue: 2 | ||
}], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
}) | ||
test('With implemented "componentDidUpdate()"', () => { | ||
let innerComponentDidUpdateCalled = false | ||
class OwnTestComponent extends React.Component{ | ||
static whyDidYouRender = true | ||
componentDidUpdate(){ | ||
innerComponentDidUpdateCalled = true | ||
} | ||
render(){ | ||
return <div>hi!</div> | ||
} | ||
test('With implemented "componentDidUpdate()"', () => { | ||
let innerComponentDidUpdateCalled = false | ||
class OwnTestComponent extends React.Component{ | ||
static whyDidYouRender = true | ||
componentDidUpdate(){ | ||
innerComponentDidUpdateCalled = true | ||
} | ||
render(){ | ||
return <div>hi!</div> | ||
} | ||
} | ||
const {rerender} = rtl.render( | ||
<OwnTestComponent a={1}/> | ||
) | ||
rerender( | ||
<OwnTestComponent a={2}/> | ||
) | ||
const {rerender} = rtl.render( | ||
<OwnTestComponent a={1}/> | ||
) | ||
rerender( | ||
<OwnTestComponent a={2}/> | ||
) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [{ | ||
pathString: 'a', | ||
diffType: diffTypes.different, | ||
prevValue: 1, | ||
nextValue: 2 | ||
}], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(innerComponentDidUpdateCalled).toBe(true) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [{ | ||
pathString: 'a', | ||
diffType: diffTypes.different, | ||
prevValue: 1, | ||
nextValue: 2 | ||
}], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(innerComponentDidUpdateCalled).toBe(true) | ||
expect(updateInfos).toHaveLength(1) | ||
}) | ||
test('With render as an arrow function', () => { | ||
class OwnTestComponent extends React.Component{ | ||
static whyDidYouRender = true | ||
componentDidMount(){ | ||
this.setState({c: 'c'}) | ||
} | ||
render = () => { | ||
return <div>hi!</div> | ||
} | ||
test('With render as an arrow function', () => { | ||
class OwnTestComponent extends React.Component{ | ||
static whyDidYouRender = true | ||
componentDidMount(){ | ||
this.setState({c: 'c'}) | ||
} | ||
render = () => { | ||
return <div>hi!</div> | ||
} | ||
} | ||
const {rerender} = rtl.render( | ||
<OwnTestComponent a={1}/> | ||
) | ||
const {rerender} = rtl.render( | ||
<OwnTestComponent a={1}/> | ||
) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: false, | ||
stateDifferences: [{ | ||
diffType: diffTypes.different, | ||
nextValue: 'c', | ||
pathString: 'c', | ||
prevValue: undefined | ||
}], | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: false, | ||
stateDifferences: [{ | ||
diffType: diffTypes.different, | ||
nextValue: 'c', | ||
pathString: 'c', | ||
prevValue: undefined | ||
}], | ||
hookDifferences: false | ||
}) | ||
rerender( | ||
<OwnTestComponent a={2}/> | ||
) | ||
rerender( | ||
<OwnTestComponent a={2}/> | ||
) | ||
expect(updateInfos[1].reason).toEqual({ | ||
propsDifferences: [{ | ||
pathString: 'a', | ||
diffType: diffTypes.different, | ||
prevValue: 1, | ||
nextValue: 2 | ||
}], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos).toHaveLength(2) | ||
expect(updateInfos[1].reason).toEqual({ | ||
propsDifferences: [{ | ||
pathString: 'a', | ||
diffType: diffTypes.different, | ||
prevValue: 1, | ||
nextValue: 2 | ||
}], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
test('With render as a binded function', () => { | ||
class OwnTestComponent extends React.Component{ | ||
static whyDidYouRender = true | ||
constructor(props, context){ | ||
super(props, context) | ||
this.render = this.render.bind(this) | ||
} | ||
componentDidMount(){ | ||
this.setState({c: 'c'}) | ||
} | ||
render(){ | ||
return <div>hi!</div> | ||
} | ||
expect(updateInfos).toHaveLength(2) | ||
}) | ||
test('With render as a binded function', () => { | ||
class OwnTestComponent extends React.Component{ | ||
static whyDidYouRender = true | ||
constructor(props, context){ | ||
super(props, context) | ||
this.render = this.render.bind(this) | ||
} | ||
componentDidMount(){ | ||
this.setState({c: 'c'}) | ||
} | ||
render(){ | ||
return <div>hi!</div> | ||
} | ||
} | ||
const {rerender} = rtl.render( | ||
<OwnTestComponent a={1}/> | ||
) | ||
const {rerender} = rtl.render( | ||
<OwnTestComponent a={1}/> | ||
) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: false, | ||
stateDifferences: [{ | ||
diffType: diffTypes.different, | ||
nextValue: 'c', | ||
pathString: 'c', | ||
prevValue: undefined | ||
}], | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: false, | ||
stateDifferences: [{ | ||
diffType: diffTypes.different, | ||
nextValue: 'c', | ||
pathString: 'c', | ||
prevValue: undefined | ||
}], | ||
hookDifferences: false | ||
}) | ||
rerender( | ||
<OwnTestComponent a={2}/> | ||
) | ||
rerender( | ||
<OwnTestComponent a={2}/> | ||
) | ||
expect(updateInfos[1].reason).toEqual({ | ||
propsDifferences: [{ | ||
pathString: 'a', | ||
diffType: diffTypes.different, | ||
prevValue: 1, | ||
nextValue: 2 | ||
}], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos).toHaveLength(2) | ||
expect(updateInfos[1].reason).toEqual({ | ||
propsDifferences: [{ | ||
pathString: 'a', | ||
diffType: diffTypes.different, | ||
prevValue: 1, | ||
nextValue: 2 | ||
}], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
test('With implemented "componentDidUpdate()" with a snapshot - not tracked', () => { | ||
let resolve = false | ||
class OwnTestComponent extends React.Component{ | ||
getSnapshotBeforeUpdate(){ | ||
return true | ||
} | ||
componentDidUpdate(prevProps, prevState, snapshot){ | ||
resolve = snapshot | ||
} | ||
render(){ | ||
return <div>hi!</div> | ||
} | ||
expect(updateInfos).toHaveLength(2) | ||
}) | ||
test('With implemented "componentDidUpdate()" with a snapshot - not tracked', () => { | ||
let resolve = false | ||
class OwnTestComponent extends React.Component{ | ||
getSnapshotBeforeUpdate(){ | ||
return true | ||
} | ||
componentDidUpdate(prevProps, prevState, snapshot){ | ||
resolve = snapshot | ||
} | ||
render(){ | ||
return <div>hi!</div> | ||
} | ||
} | ||
const {rerender} = rtl.render( | ||
<OwnTestComponent a={1}/> | ||
) | ||
rerender( | ||
<OwnTestComponent a={1}/> | ||
) | ||
const {rerender} = rtl.render( | ||
<OwnTestComponent a={1}/> | ||
) | ||
rerender( | ||
<OwnTestComponent a={1}/> | ||
) | ||
expect(resolve).toBe(true) | ||
expect(updateInfos).toHaveLength(0) | ||
}) | ||
expect(resolve).toBe(true) | ||
expect(updateInfos).toHaveLength(0) | ||
}) | ||
test('With implemented "componentDidUpdate()" with a snapshot', () => { | ||
let resolve = false | ||
class OwnTestComponent extends React.Component{ | ||
static whyDidYouRender = true | ||
getSnapshotBeforeUpdate(){ | ||
return true | ||
} | ||
componentDidUpdate(prevProps, prevState, snapshot){ | ||
resolve = snapshot | ||
} | ||
render(){ | ||
return <div>hi!</div> | ||
} | ||
test('With implemented "componentDidUpdate()" with a snapshot', () => { | ||
let resolve = false | ||
class OwnTestComponent extends React.Component{ | ||
static whyDidYouRender = true | ||
getSnapshotBeforeUpdate(){ | ||
return true | ||
} | ||
componentDidUpdate(prevProps, prevState, snapshot){ | ||
resolve = snapshot | ||
} | ||
render(){ | ||
return <div>hi!</div> | ||
} | ||
} | ||
const {rerender} = rtl.render( | ||
<OwnTestComponent a={1}/> | ||
) | ||
rerender( | ||
<OwnTestComponent a={1}/> | ||
) | ||
const {rerender} = rtl.render( | ||
<OwnTestComponent a={1}/> | ||
) | ||
rerender( | ||
<OwnTestComponent a={1}/> | ||
) | ||
expect(resolve).toBe(true) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(resolve).toBe(true) | ||
expect(updateInfos).toHaveLength(1) | ||
}) | ||
test('Component created with "createReactClass"', () => { | ||
const CreateReactClassComponent = createReactClass({ | ||
displayName: 'Foo', | ||
render(){ | ||
return <div>hi!</div> | ||
} | ||
}) | ||
test('Component created with "createReactClass"', () => { | ||
const CreateReactClassComponent = createReactClass({ | ||
displayName: 'Foo', | ||
render(){ | ||
return <div>hi!</div> | ||
} | ||
}) | ||
CreateReactClassComponent.whyDidYouRender = true | ||
CreateReactClassComponent.whyDidYouRender = true | ||
const {rerender} = rtl.render( | ||
<CreateReactClassComponent a={1}/> | ||
) | ||
rerender( | ||
<CreateReactClassComponent a={2}/> | ||
) | ||
const {rerender} = rtl.render( | ||
<CreateReactClassComponent a={1}/> | ||
) | ||
rerender( | ||
<CreateReactClassComponent a={2}/> | ||
) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [{ | ||
pathString: 'a', | ||
diffType: diffTypes.different, | ||
prevValue: 1, | ||
nextValue: 2 | ||
}], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
}) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [{ | ||
pathString: 'a', | ||
diffType: diffTypes.different, | ||
prevValue: 1, | ||
nextValue: 2 | ||
}], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
test('Component created with "createReactClass" with implemented "componentDidUpdate()"', () => { | ||
let innerComponentDidUpdateCalled = false | ||
const CreateReactClassComponent = createReactClass({ | ||
displayName: 'Foo', | ||
componentDidUpdate(){ | ||
innerComponentDidUpdateCalled = true | ||
}, | ||
render(){ | ||
return <div>hi!</div> | ||
} | ||
}) | ||
test('Component created with "createReactClass" with implemented "componentDidUpdate()"', () => { | ||
let innerComponentDidUpdateCalled = false | ||
const CreateReactClassComponent = createReactClass({ | ||
displayName: 'Foo', | ||
componentDidUpdate(){ | ||
innerComponentDidUpdateCalled = true | ||
}, | ||
render(){ | ||
return <div>hi!</div> | ||
} | ||
}) | ||
CreateReactClassComponent.whyDidYouRender = true | ||
CreateReactClassComponent.whyDidYouRender = true | ||
const {rerender} = rtl.render( | ||
<CreateReactClassComponent a={1}/> | ||
) | ||
rerender( | ||
<CreateReactClassComponent a={2}/> | ||
) | ||
const {rerender} = rtl.render( | ||
<CreateReactClassComponent a={1}/> | ||
) | ||
rerender( | ||
<CreateReactClassComponent a={2}/> | ||
) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [{ | ||
pathString: 'a', | ||
diffType: diffTypes.different, | ||
prevValue: 1, | ||
nextValue: 2 | ||
}], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(innerComponentDidUpdateCalled).toBe(true) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [{ | ||
pathString: 'a', | ||
diffType: diffTypes.different, | ||
prevValue: 1, | ||
nextValue: 2 | ||
}], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(innerComponentDidUpdateCalled).toBe(true) | ||
}) | ||
test('Element created with "createFactory"', () => { | ||
const TestComponentElementCreator = React.createFactory(TestComponent) | ||
test('Element created with "createFactory"', () => { | ||
const TestComponentElementCreator = React.createFactory(TestComponent) | ||
const {rerender} = rtl.render( | ||
TestComponentElementCreator({a: 1}) | ||
) | ||
rerender( | ||
TestComponentElementCreator({a: 1}) | ||
) | ||
const {rerender} = rtl.render( | ||
TestComponentElementCreator({a: 1}) | ||
) | ||
rerender( | ||
TestComponentElementCreator({a: 1}) | ||
) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
test('Element created with "cloneElement"', () => { | ||
const testElement = <TestComponent a={1}/> | ||
const testElement2 = React.cloneElement(testElement) | ||
expect(updateInfos).toHaveLength(1) | ||
}) | ||
const {rerender} = rtl.render(testElement) | ||
rerender(testElement2) | ||
test('Element created with "cloneElement"', () => { | ||
const testElement = <TestComponent a={1}/> | ||
const testElement2 = React.cloneElement(testElement) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
const {rerender} = rtl.render(testElement) | ||
rerender(testElement2) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
}) | ||
test('Several class components', () => { | ||
const {rerender} = rtl.render( | ||
<> | ||
<TestComponent/> | ||
<TestComponent a={{a: 'a'}}/> | ||
<TestComponent/> | ||
</> | ||
) | ||
test('Several class components', () => { | ||
const {rerender} = rtl.render( | ||
<> | ||
<TestComponent/> | ||
<TestComponent a={{a: 'a'}}/> | ||
<TestComponent/> | ||
</> | ||
) | ||
rerender( | ||
<> | ||
<TestComponent/> | ||
<TestComponent a={{a: 'a'}}/> | ||
<TestComponent/> | ||
</> | ||
) | ||
rerender( | ||
<> | ||
<TestComponent/> | ||
<TestComponent a={{a: 'a'}}/> | ||
<TestComponent/> | ||
</> | ||
) | ||
expect(updateInfos).toHaveLength(3) | ||
expect(updateInfos).toHaveLength(3) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos[1].reason).toEqual({ | ||
propsDifferences: [{ | ||
diffType: diffTypes.deepEquals, | ||
pathString: 'a', | ||
nextValue: {a: 'a'}, | ||
prevValue: {a: 'a'} | ||
}], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos[1].reason).toEqual({ | ||
propsDifferences: [{ | ||
diffType: diffTypes.deepEquals, | ||
pathString: 'a', | ||
nextValue: {a: 'a'}, | ||
prevValue: {a: 'a'} | ||
}], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos[2].reason).toEqual({ | ||
propsDifferences: [], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos[2].reason).toEqual({ | ||
propsDifferences: [], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
}) | ||
test('Strict mode- class component no props change', () => { | ||
const {rerender} = rtl.render( | ||
<React.StrictMode> | ||
<div> | ||
<TestComponent a={1}/> | ||
</div> | ||
</React.StrictMode> | ||
) | ||
test('Strict mode- class component no props change', () => { | ||
const {rerender} = rtl.render( | ||
<React.StrictMode> | ||
<div> | ||
<TestComponent a={1}/> | ||
</div> | ||
</React.StrictMode> | ||
) | ||
rerender( | ||
<React.StrictMode> | ||
<div> | ||
<TestComponent a={1}/> | ||
</div> | ||
</React.StrictMode> | ||
) | ||
rerender( | ||
<React.StrictMode> | ||
<div> | ||
<TestComponent a={1}/> | ||
</div> | ||
</React.StrictMode> | ||
) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
}) | ||
test('Strict mode- class component props change', () => { | ||
const {rerender} = rtl.render( | ||
<React.StrictMode> | ||
<div> | ||
<TestComponent a={[]}/> | ||
</div> | ||
</React.StrictMode> | ||
) | ||
test('Strict mode- class component props change', () => { | ||
const {rerender} = rtl.render( | ||
<React.StrictMode> | ||
<div> | ||
<TestComponent a={[]}/> | ||
</div> | ||
</React.StrictMode> | ||
) | ||
rerender( | ||
<React.StrictMode> | ||
<div> | ||
<TestComponent a={[]}/> | ||
</div> | ||
</React.StrictMode> | ||
) | ||
rerender( | ||
<React.StrictMode> | ||
<div> | ||
<TestComponent a={[]}/> | ||
</div> | ||
</React.StrictMode> | ||
) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [ | ||
{ | ||
pathString: 'a', | ||
diffType: diffTypes.deepEquals, | ||
prevValue: [], | ||
nextValue: [] | ||
} | ||
], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [ | ||
{ | ||
pathString: 'a', | ||
diffType: diffTypes.deepEquals, | ||
prevValue: [], | ||
nextValue: [] | ||
} | ||
], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
}) | ||
test('Strict mode- pure class component no props change', () => { | ||
const {rerender} = rtl.render( | ||
<React.StrictMode> | ||
<div> | ||
<PureTestComponent a={1}/> | ||
</div> | ||
</React.StrictMode> | ||
) | ||
test('Strict mode- pure class component no props change', () => { | ||
const {rerender} = rtl.render( | ||
<React.StrictMode> | ||
<div> | ||
<PureTestComponent a={1}/> | ||
</div> | ||
</React.StrictMode> | ||
) | ||
rerender( | ||
<React.StrictMode> | ||
<div> | ||
<PureTestComponent a={1}/> | ||
</div> | ||
</React.StrictMode> | ||
) | ||
rerender( | ||
<React.StrictMode> | ||
<div> | ||
<PureTestComponent a={1}/> | ||
</div> | ||
</React.StrictMode> | ||
) | ||
expect(updateInfos).toHaveLength(0) | ||
}) | ||
expect(updateInfos).toHaveLength(0) | ||
}) | ||
test('Strict mode- pure class component props change', () => { | ||
const {rerender} = rtl.render( | ||
<React.StrictMode> | ||
<div> | ||
<PureTestComponent a={[]}/> | ||
</div> | ||
</React.StrictMode> | ||
) | ||
test('Strict mode- pure class component props change', () => { | ||
const {rerender} = rtl.render( | ||
<React.StrictMode> | ||
<div> | ||
<PureTestComponent a={[]}/> | ||
</div> | ||
</React.StrictMode> | ||
) | ||
rerender( | ||
<React.StrictMode> | ||
<div> | ||
<PureTestComponent a={[]}/> | ||
</div> | ||
</React.StrictMode> | ||
) | ||
rerender( | ||
<React.StrictMode> | ||
<div> | ||
<PureTestComponent a={[]}/> | ||
</div> | ||
</React.StrictMode> | ||
) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [ | ||
{ | ||
pathString: 'a', | ||
diffType: diffTypes.deepEquals, | ||
prevValue: [], | ||
nextValue: [] | ||
} | ||
], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [ | ||
{ | ||
pathString: 'a', | ||
diffType: diffTypes.deepEquals, | ||
prevValue: [], | ||
nextValue: [] | ||
} | ||
], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
}) |
@@ -6,112 +6,107 @@ /* eslint-disable no-console */ | ||
import {diffTypes} from '../consts' | ||
import errorOnConsoleOutput from '../utils/errorOnConsoleOutput' | ||
describe('patch component with forward ref', () => { | ||
errorOnConsoleOutput() | ||
let updateInfos = [] | ||
beforeEach(() => { | ||
updateInfos = [] | ||
whyDidYouRender(React, { | ||
notifier: updateInfo => updateInfos.push(updateInfo) | ||
}) | ||
let updateInfos = [] | ||
beforeEach(() => { | ||
updateInfos = [] | ||
whyDidYouRender(React, { | ||
notifier: updateInfo => updateInfos.push(updateInfo) | ||
}) | ||
}) | ||
afterEach(() => { | ||
React.__REVERT_WHY_DID_YOU_RENDER__() | ||
}) | ||
afterEach(() => { | ||
React.__REVERT_WHY_DID_YOU_RENDER__() | ||
}) | ||
test('forward ref', () => { | ||
const content = 'My component!!!' | ||
test('forward ref', () => { | ||
const content = 'My component!!!' | ||
const MyComponent = React.forwardRef((props, ref) => { | ||
return <div ref={ref}>{content}</div> | ||
}) | ||
const MyComponent = React.forwardRef((props, ref) => { | ||
return <div ref={ref}>{content}</div> | ||
}) | ||
MyComponent.whyDidYouRender = true | ||
MyComponent.whyDidYouRender = true | ||
let componentContentFromRef = null | ||
let timesRefWasCalled = 0 | ||
let componentContentFromRef = null | ||
let timesRefWasCalled = 0 | ||
const handleRef = ref => { | ||
if(!ref){ | ||
return | ||
} | ||
timesRefWasCalled++ | ||
componentContentFromRef = ref.innerHTML | ||
const handleRef = ref => { | ||
if(!ref){ | ||
return | ||
} | ||
timesRefWasCalled++ | ||
componentContentFromRef = ref.innerHTML | ||
} | ||
const {rerender} = rtl.render( | ||
<MyComponent a={[]} ref={handleRef}/> | ||
) | ||
const {rerender} = rtl.render( | ||
<MyComponent a={[]} ref={handleRef}/> | ||
) | ||
rerender( | ||
<MyComponent a={[]} ref={handleRef}/> | ||
) | ||
rerender( | ||
<MyComponent a={[]} ref={handleRef}/> | ||
) | ||
expect(componentContentFromRef).toBe(content) | ||
expect(timesRefWasCalled).toBe(1) | ||
expect(componentContentFromRef).toBe(content) | ||
expect(timesRefWasCalled).toBe(1) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [ | ||
{ | ||
pathString: 'a', | ||
diffType: diffTypes.deepEquals, | ||
prevValue: [], | ||
nextValue: [] | ||
} | ||
], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [ | ||
{ | ||
pathString: 'a', | ||
diffType: diffTypes.deepEquals, | ||
prevValue: [], | ||
nextValue: [] | ||
} | ||
], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
}) | ||
test('forward ref a memo component', () => { | ||
/* turns out this is not supported by react at this point. */ | ||
test('forward ref a memo component', () => { | ||
/* turns out this is not supported by react at this point. */ | ||
// const content = 'My component!!!' | ||
// | ||
// const MyComponent = React.forwardRef(React.memo((props, ref) => { | ||
// return <div ref={ref}>{content}</div> | ||
// }, () => true)) | ||
// | ||
// MyComponent.whyDidYouRender = true | ||
// | ||
// let componentContentFromRef = null | ||
// let timesRefWasCalled = 0 | ||
// | ||
// const handleRef = ref => { | ||
// if(!ref){ | ||
// return | ||
// } | ||
// timesRefWasCalled++ | ||
// componentContentFromRef = ref.innerHTML | ||
// } | ||
// | ||
// const {rerender} = rtl.render( | ||
// <MyComponent a={[]} ref={handleRef}/> | ||
// ) | ||
// | ||
// rerender( | ||
// <MyComponent a={[]} ref={handleRef}/> | ||
// ) | ||
// | ||
// expect(componentContentFromRef).toBe(content) | ||
// expect(timesRefWasCalled).toBe(1) | ||
// | ||
// expect(updateInfos).toHaveLength(1) | ||
// expect(updateInfos[0].reason).toEqual({ | ||
// propsDifferences: [ | ||
// { | ||
// pathString: 'a', | ||
// diffType: diffTypes.deepEquals, | ||
// prevValue: [], | ||
// nextValue: [] | ||
// } | ||
// ], | ||
// stateDifferences: false, | ||
// hookDifferences: false | ||
// }) | ||
}) | ||
// const content = 'My component!!!' | ||
// | ||
// const MyComponent = React.forwardRef(React.memo((props, ref) => { | ||
// return <div ref={ref}>{content}</div> | ||
// }, () => true)) | ||
// | ||
// MyComponent.whyDidYouRender = true | ||
// | ||
// let componentContentFromRef = null | ||
// let timesRefWasCalled = 0 | ||
// | ||
// const handleRef = ref => { | ||
// if(!ref){ | ||
// return | ||
// } | ||
// timesRefWasCalled++ | ||
// componentContentFromRef = ref.innerHTML | ||
// } | ||
// | ||
// const {rerender} = rtl.render( | ||
// <MyComponent a={[]} ref={handleRef}/> | ||
// ) | ||
// | ||
// rerender( | ||
// <MyComponent a={[]} ref={handleRef}/> | ||
// ) | ||
// | ||
// expect(componentContentFromRef).toBe(content) | ||
// expect(timesRefWasCalled).toBe(1) | ||
// | ||
// expect(updateInfos).toHaveLength(1) | ||
// expect(updateInfos[0].reason).toEqual({ | ||
// propsDifferences: [ | ||
// { | ||
// pathString: 'a', | ||
// diffType: diffTypes.deepEquals, | ||
// prevValue: [], | ||
// nextValue: [] | ||
// } | ||
// ], | ||
// stateDifferences: false, | ||
// hookDifferences: false | ||
// }) | ||
}) |
@@ -6,3 +6,2 @@ /* eslint-disable no-console */ | ||
import {diffTypes} from '../consts' | ||
import errorOnConsoleOutput from '../utils/errorOnConsoleOutput' | ||
@@ -14,142 +13,138 @@ const FunctionalTestComponent = () => ( | ||
describe('patch functional component', () => { | ||
errorOnConsoleOutput() | ||
let updateInfos = [] | ||
beforeEach(() => { | ||
updateInfos = [] | ||
whyDidYouRender(React, { | ||
notifier: updateInfo => updateInfos.push(updateInfo) | ||
}) | ||
let updateInfos = [] | ||
beforeEach(() => { | ||
updateInfos = [] | ||
whyDidYouRender(React, { | ||
notifier: updateInfo => updateInfos.push(updateInfo) | ||
}) | ||
}) | ||
afterEach(() => { | ||
React.__REVERT_WHY_DID_YOU_RENDER__() | ||
}) | ||
afterEach(() => { | ||
React.__REVERT_WHY_DID_YOU_RENDER__() | ||
}) | ||
test('simple inline component', () => { | ||
const InlineComponent = () => ( | ||
<div>hi!</div> | ||
) | ||
InlineComponent.whyDidYouRender = true | ||
test('simple inline component', () => { | ||
const InlineComponent = () => ( | ||
<div>hi!</div> | ||
) | ||
InlineComponent.whyDidYouRender = true | ||
const {rerender} = rtl.render( | ||
<InlineComponent a={1}/> | ||
) | ||
rerender( | ||
<InlineComponent a={2}/> | ||
) | ||
const {rerender} = rtl.render( | ||
<InlineComponent a={1}/> | ||
) | ||
rerender( | ||
<InlineComponent a={2}/> | ||
) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [{ | ||
pathString: 'a', | ||
diffType: diffTypes.different, | ||
prevValue: 1, | ||
nextValue: 2 | ||
}], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [{ | ||
pathString: 'a', | ||
diffType: diffTypes.different, | ||
prevValue: 1, | ||
nextValue: 2 | ||
}], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
}) | ||
test('Several functional components', () => { | ||
const {rerender} = rtl.render( | ||
<> | ||
<FunctionalTestComponent/> | ||
<FunctionalTestComponent a={{a: 'a'}}/> | ||
<FunctionalTestComponent/> | ||
</> | ||
) | ||
test('Several functional components', () => { | ||
const {rerender} = rtl.render( | ||
<> | ||
<FunctionalTestComponent/> | ||
<FunctionalTestComponent a={{a: 'a'}}/> | ||
<FunctionalTestComponent/> | ||
</> | ||
) | ||
rerender( | ||
<> | ||
<FunctionalTestComponent/> | ||
<FunctionalTestComponent a={{a: 'a'}}/> | ||
<FunctionalTestComponent/> | ||
</> | ||
) | ||
rerender( | ||
<> | ||
<FunctionalTestComponent/> | ||
<FunctionalTestComponent a={{a: 'a'}}/> | ||
<FunctionalTestComponent/> | ||
</> | ||
) | ||
expect(updateInfos).toHaveLength(3) | ||
expect(updateInfos).toHaveLength(3) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos[1].reason).toEqual({ | ||
propsDifferences: [{ | ||
diffType: diffTypes.deepEquals, | ||
pathString: 'a', | ||
nextValue: {a: 'a'}, | ||
prevValue: {a: 'a'} | ||
}], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos[1].reason).toEqual({ | ||
propsDifferences: [{ | ||
diffType: diffTypes.deepEquals, | ||
pathString: 'a', | ||
nextValue: {a: 'a'}, | ||
prevValue: {a: 'a'} | ||
}], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos[2].reason).toEqual({ | ||
propsDifferences: [], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos[2].reason).toEqual({ | ||
propsDifferences: [], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
}) | ||
test('Strict mode- functional component no props change', () => { | ||
const Main = props => { | ||
return ( | ||
<React.StrictMode> | ||
<div> | ||
<FunctionalTestComponent {...props}/> | ||
</div> | ||
</React.StrictMode> | ||
) | ||
} | ||
const {rerender} = rtl.render( | ||
<Main a={1}/> | ||
test('Strict mode- functional component no props change', () => { | ||
const Main = props => { | ||
return ( | ||
<React.StrictMode> | ||
<div> | ||
<FunctionalTestComponent {...props}/> | ||
</div> | ||
</React.StrictMode> | ||
) | ||
} | ||
const {rerender} = rtl.render( | ||
<Main a={1}/> | ||
) | ||
rerender( | ||
<Main a={1}/> | ||
) | ||
rerender( | ||
<Main a={1}/> | ||
) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
}) | ||
test('Strict mode- functional component with props change', () => { | ||
const Main = props => { | ||
return ( | ||
<React.StrictMode> | ||
<div> | ||
<FunctionalTestComponent {...props}/> | ||
</div> | ||
</React.StrictMode> | ||
) | ||
} | ||
const {rerender} = rtl.render( | ||
<Main a={[]}/> | ||
test('Strict mode- functional component with props change', () => { | ||
const Main = props => { | ||
return ( | ||
<React.StrictMode> | ||
<div> | ||
<FunctionalTestComponent {...props}/> | ||
</div> | ||
</React.StrictMode> | ||
) | ||
} | ||
const {rerender} = rtl.render( | ||
<Main a={[]}/> | ||
) | ||
rerender( | ||
<Main a={[]}/> | ||
) | ||
rerender( | ||
<Main a={[]}/> | ||
) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [{ | ||
diffType: diffTypes.deepEquals, | ||
pathString: 'a', | ||
prevValue: [], | ||
nextValue: [] | ||
}], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [{ | ||
diffType: diffTypes.deepEquals, | ||
pathString: 'a', | ||
prevValue: [], | ||
nextValue: [] | ||
}], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
}) |
@@ -6,3 +6,2 @@ /* eslint-disable no-console */ | ||
import {diffTypes} from '../consts' | ||
import errorOnConsoleOutput from '../utils/errorOnConsoleOutput' | ||
@@ -15,145 +14,142 @@ const ReactMemoTestComponent = React.memo(() => ( | ||
describe('patch memoized component', () => { | ||
errorOnConsoleOutput() | ||
let updateInfos = [] | ||
beforeEach(() => { | ||
updateInfos = [] | ||
whyDidYouRender(React, { | ||
notifier: updateInfo => updateInfos.push(updateInfo) | ||
}) | ||
let updateInfos = [] | ||
beforeEach(() => { | ||
updateInfos = [] | ||
whyDidYouRender(React, { | ||
notifier: updateInfo => updateInfos.push(updateInfo) | ||
}) | ||
}) | ||
afterEach(() => { | ||
React.__REVERT_WHY_DID_YOU_RENDER__() | ||
}) | ||
afterEach(() => { | ||
React.__REVERT_WHY_DID_YOU_RENDER__() | ||
}) | ||
test('Component memoized with React.memo', () => { | ||
const {rerender} = rtl.render( | ||
<ReactMemoTestComponent a={1}/> | ||
) | ||
rerender( | ||
<ReactMemoTestComponent a={2}/> | ||
) | ||
test('Component memoized with React.memo', () => { | ||
const {rerender} = rtl.render( | ||
<ReactMemoTestComponent a={1}/> | ||
) | ||
rerender( | ||
<ReactMemoTestComponent a={2}/> | ||
) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [{ | ||
pathString: 'a', | ||
diffType: diffTypes.different, | ||
prevValue: 1, | ||
nextValue: 2 | ||
}], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [{ | ||
pathString: 'a', | ||
diffType: diffTypes.different, | ||
prevValue: 1, | ||
nextValue: 2 | ||
}], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
}) | ||
test('Component memoized with React.memo - no change', () => { | ||
const {rerender} = rtl.render( | ||
<ReactMemoTestComponent a={1}/> | ||
) | ||
rerender( | ||
<ReactMemoTestComponent a={1}/> | ||
) | ||
test('Component memoized with React.memo - no change', () => { | ||
const {rerender} = rtl.render( | ||
<ReactMemoTestComponent a={1}/> | ||
) | ||
rerender( | ||
<ReactMemoTestComponent a={1}/> | ||
) | ||
expect(updateInfos).toHaveLength(0) | ||
}) | ||
expect(updateInfos).toHaveLength(0) | ||
}) | ||
test('Strict mode- memoized functional component with no props change', () => { | ||
const Main = props => { | ||
return ( | ||
<React.StrictMode> | ||
<div> | ||
<ReactMemoTestComponent {...props}/> | ||
</div> | ||
</React.StrictMode> | ||
) | ||
} | ||
const {rerender} = rtl.render( | ||
<Main a={1}/> | ||
test('Strict mode- memoized functional component with no props change', () => { | ||
const Main = props => { | ||
return ( | ||
<React.StrictMode> | ||
<div> | ||
<ReactMemoTestComponent {...props}/> | ||
</div> | ||
</React.StrictMode> | ||
) | ||
} | ||
const {rerender} = rtl.render( | ||
<Main a={1}/> | ||
) | ||
rerender( | ||
<Main a={1}/> | ||
) | ||
rerender( | ||
<Main a={1}/> | ||
) | ||
expect(updateInfos).toHaveLength(0) | ||
}) | ||
expect(updateInfos).toHaveLength(0) | ||
}) | ||
test('Strict mode- memoized functional component with props change', () => { | ||
const Main = props => { | ||
return ( | ||
<React.StrictMode> | ||
<div> | ||
<ReactMemoTestComponent {...props}/> | ||
</div> | ||
</React.StrictMode> | ||
) | ||
} | ||
const {rerender} = rtl.render( | ||
<Main a={1} b={[]}/> | ||
test('Strict mode- memoized functional component with props change', () => { | ||
const Main = props => { | ||
return ( | ||
<React.StrictMode> | ||
<div> | ||
<ReactMemoTestComponent {...props}/> | ||
</div> | ||
</React.StrictMode> | ||
) | ||
} | ||
const {rerender} = rtl.render( | ||
<Main a={1} b={[]}/> | ||
) | ||
rerender( | ||
<Main a={1} b={[]}/> | ||
) | ||
rerender( | ||
<Main a={1} b={[]}/> | ||
) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [{ | ||
diffType: diffTypes.deepEquals, | ||
prevValue: [], | ||
nextValue: [], | ||
pathString: 'b' | ||
}], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [{ | ||
diffType: diffTypes.deepEquals, | ||
prevValue: [], | ||
nextValue: [], | ||
pathString: 'b' | ||
}], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
}) | ||
test('memo a forward ref component', () => { | ||
const content = 'My component!!!' | ||
test('memo a forward ref component', () => { | ||
const content = 'My component!!!' | ||
const MyComponent = React.memo(React.forwardRef((props, ref) => { | ||
return <div ref={ref}>{content}</div> | ||
})) | ||
const MyComponent = React.memo(React.forwardRef((props, ref) => { | ||
return <div ref={ref}>{content}</div> | ||
})) | ||
MyComponent.whyDidYouRender = true | ||
MyComponent.whyDidYouRender = true | ||
let componentContentFromRef = null | ||
let timesRefWasCalled = 0 | ||
let componentContentFromRef = null | ||
let timesRefWasCalled = 0 | ||
const handleRef = ref => { | ||
if(!ref){ | ||
return | ||
} | ||
timesRefWasCalled++ | ||
componentContentFromRef = ref.innerHTML | ||
const handleRef = ref => { | ||
if(!ref){ | ||
return | ||
} | ||
timesRefWasCalled++ | ||
componentContentFromRef = ref.innerHTML | ||
} | ||
const {rerender} = rtl.render( | ||
<MyComponent a={[]} ref={handleRef}/> | ||
) | ||
const {rerender} = rtl.render( | ||
<MyComponent a={[]} ref={handleRef}/> | ||
) | ||
rerender( | ||
<MyComponent a={[]} ref={handleRef}/> | ||
) | ||
rerender( | ||
<MyComponent a={[]} ref={handleRef}/> | ||
) | ||
expect(componentContentFromRef).toBe(content) | ||
expect(timesRefWasCalled).toBe(1) | ||
expect(componentContentFromRef).toBe(content) | ||
expect(timesRefWasCalled).toBe(1) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [ | ||
{ | ||
pathString: 'a', | ||
diffType: diffTypes.deepEquals, | ||
prevValue: [], | ||
nextValue: [] | ||
} | ||
], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
expect(updateInfos).toHaveLength(1) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [ | ||
{ | ||
pathString: 'a', | ||
diffType: diffTypes.deepEquals, | ||
prevValue: [], | ||
nextValue: [] | ||
} | ||
], | ||
stateDifferences: false, | ||
hookDifferences: false | ||
}) | ||
}) |
@@ -19,33 +19,31 @@ import React from 'react' | ||
describe('shouldTrack', () => { | ||
test('Do not track not tracked component (default)', () => { | ||
const isShouldTrack = shouldTrack(NotTrackedTestComponent, getDisplayName(NotTrackedTestComponent), {}) | ||
expect(isShouldTrack).toBe(false) | ||
}) | ||
test('Do not track not tracked component (default)', () => { | ||
const isShouldTrack = shouldTrack(NotTrackedTestComponent, getDisplayName(NotTrackedTestComponent), {}) | ||
expect(isShouldTrack).toBe(false) | ||
}) | ||
test('Track tracked component', () => { | ||
const isShouldTrack = shouldTrack(TrackedTestComponent, getDisplayName(TrackedTestComponent), {}) | ||
expect(isShouldTrack).toBe(true) | ||
}) | ||
test('Track tracked component', () => { | ||
const isShouldTrack = shouldTrack(TrackedTestComponent, getDisplayName(TrackedTestComponent), {}) | ||
expect(isShouldTrack).toBe(true) | ||
}) | ||
test('Track included not tracked components', () => { | ||
const isShouldTrack = shouldTrack(NotTrackedTestComponent, getDisplayName(NotTrackedTestComponent), { | ||
include: [/TestComponent/] | ||
}) | ||
expect(isShouldTrack).toBe(true) | ||
test('Track included not tracked components', () => { | ||
const isShouldTrack = shouldTrack(NotTrackedTestComponent, getDisplayName(NotTrackedTestComponent), { | ||
include: [/TestComponent/] | ||
}) | ||
expect(isShouldTrack).toBe(true) | ||
}) | ||
test('Do not track not included not tracked components', () => { | ||
const isShouldTrack = shouldTrack(NotTrackedTestComponent, getDisplayName(NotTrackedTestComponent), { | ||
include: [/0/] | ||
}) | ||
expect(isShouldTrack).toBe(false) | ||
test('Do not track not included not tracked components', () => { | ||
const isShouldTrack = shouldTrack(NotTrackedTestComponent, getDisplayName(NotTrackedTestComponent), { | ||
include: [/0/] | ||
}) | ||
expect(isShouldTrack).toBe(false) | ||
}) | ||
test('Do not track excluded tracked components', () => { | ||
const isShouldTrack = shouldTrack(TrackedTestComponent, getDisplayName(NotTrackedTestComponent), { | ||
exclude: [/TrackedTestComponent/] | ||
}) | ||
expect(isShouldTrack).toBe(false) | ||
test('Do not track excluded tracked components', () => { | ||
const isShouldTrack = shouldTrack(TrackedTestComponent, getDisplayName(NotTrackedTestComponent), { | ||
exclude: [/TrackedTestComponent/] | ||
}) | ||
expect(isShouldTrack).toBe(false) | ||
}) |
// copied from https://github.com/facebook/react/blob/master/packages/react-reconciler/src/ReactTypeOfMode.js | ||
const StrictMode = 0b010 | ||
const StrictMode = 0b0001 | ||
@@ -8,3 +8,3 @@ // based on "findStrictRoot" from https://github.com/facebook/react/blob/master/packages/react-reconciler/src/ReactStrictModeWarnings.js | ||
let reactInternalFiber = reactComponentInstance._reactInternalFiber | ||
while(reactInternalFiber){ | ||
while(reactInternalFiber !== null){ | ||
if(reactInternalFiber.mode & StrictMode){ | ||
@@ -11,0 +11,0 @@ return true |
@@ -5,72 +5,70 @@ import React from 'react' | ||
describe('utils', () => { | ||
describe('checkIfInsideAStrictModeTree', () => { | ||
test('class component', () => { | ||
let isStrictMode | ||
class TestComponent extends React.Component{ | ||
static whyDidYouRender = true | ||
render(){ | ||
isStrictMode = checkIfInsideAStrictModeTree(this) | ||
return <div>hi!</div> | ||
} | ||
describe('checkIfInsideAStrictModeTree', () => { | ||
test('class component', () => { | ||
let isStrictMode | ||
class TestComponent extends React.Component{ | ||
static whyDidYouRender = true | ||
render(){ | ||
isStrictMode = checkIfInsideAStrictModeTree(this) | ||
return <div>hi!</div> | ||
} | ||
} | ||
rtl.render( | ||
<div> | ||
<TestComponent/> | ||
</div> | ||
) | ||
rtl.render( | ||
<div> | ||
<TestComponent/> | ||
</div> | ||
) | ||
expect(isStrictMode).toBe(false) | ||
expect(isStrictMode).toBe(false) | ||
rtl.render( | ||
<React.StrictMode> | ||
<> | ||
<div> | ||
<TestComponent/> | ||
</div> | ||
<div> | ||
hiiiiiiiii | ||
</div> | ||
</> | ||
</React.StrictMode> | ||
) | ||
rtl.render( | ||
<React.StrictMode> | ||
<> | ||
<div> | ||
<TestComponent/> | ||
</div> | ||
<div> | ||
hiiiiiiiii | ||
</div> | ||
</> | ||
</React.StrictMode> | ||
) | ||
expect(isStrictMode).toBe(true) | ||
}) | ||
expect(isStrictMode).toBe(true) | ||
}) | ||
test('pure class component', () => { | ||
let isStrictMode | ||
class TestComponent extends React.PureComponent{ | ||
static whyDidYouRender = true | ||
render(){ | ||
isStrictMode = checkIfInsideAStrictModeTree(this) | ||
return <div>hi!</div> | ||
} | ||
test('pure class component', () => { | ||
let isStrictMode | ||
class TestComponent extends React.PureComponent{ | ||
static whyDidYouRender = true | ||
render(){ | ||
isStrictMode = checkIfInsideAStrictModeTree(this) | ||
return <div>hi!</div> | ||
} | ||
} | ||
rtl.render( | ||
<div> | ||
<TestComponent/> | ||
</div> | ||
) | ||
rtl.render( | ||
<div> | ||
<TestComponent/> | ||
</div> | ||
) | ||
expect(isStrictMode).toBe(false) | ||
expect(isStrictMode).toBe(false) | ||
rtl.render( | ||
<React.StrictMode> | ||
<> | ||
<div> | ||
<TestComponent/> | ||
</div> | ||
<div> | ||
hiiiiiiiii | ||
</div> | ||
</> | ||
</React.StrictMode> | ||
) | ||
rtl.render( | ||
<React.StrictMode> | ||
<> | ||
<div> | ||
<TestComponent/> | ||
</div> | ||
<div> | ||
hiiiiiiiii | ||
</div> | ||
</> | ||
</React.StrictMode> | ||
) | ||
expect(isStrictMode).toBe(true) | ||
}) | ||
expect(isStrictMode).toBe(true) | ||
}) | ||
}) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1213356
53
15614