@welldone-software/why-did-you-render
Advanced tools
Comparing version 2.5.2 to 2.6.0
/** | ||
* @welldone-software/why-did-you-render 2.5.2 | ||
* @welldone-software/why-did-you-render 2.6.0 | ||
* MIT Licensed | ||
* Generated by Vitali Zaidman <vzaidman@gmail.com> (https://github.com/vzaidman) | ||
* Generated at 2019-02-12 | ||
* Generated at 2019-03-18 | ||
*/ | ||
@@ -12,2 +12,3 @@ | ||
var _defaults = _interopDefault(require('lodash/defaults')); | ||
var _isString = _interopDefault(require('lodash/isString')); | ||
@@ -313,3 +314,3 @@ var _reduce = _interopDefault(require('lodash/reduce')); | ||
function getDisplayName(type) { | ||
return type.displayName || type.name || (_isString(type) ? type : undefined); | ||
return type.displayName || type.name || type.type && getDisplayName(type.type) || (_isString(type) ? type : undefined); | ||
} | ||
@@ -320,6 +321,6 @@ | ||
var hasSymbol = typeof Symbol === 'function' && Symbol.for; | ||
var REACT_ELEMENT_TYPE$1 = hasSymbol ? Symbol.for('react.element') : 0xeac7; | ||
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7; | ||
var isReactElement = function isReactElement(object) { | ||
return object.$$typeof === REACT_ELEMENT_TYPE$1; | ||
return object.$$typeof === REACT_ELEMENT_TYPE; | ||
}; // end | ||
@@ -508,2 +509,5 @@ | ||
var hasSymbol$1 = typeof Symbol === 'function' && Symbol.for; | ||
var REACT_MEMO_TYPE = hasSymbol$1 ? Symbol.for('react.memo') : 0xead3; | ||
function patchClassComponent(ClassComponent, displayName, React, options) { | ||
@@ -527,3 +531,3 @@ var WDYRPatchedClassComponent = | ||
_this.render = function () { | ||
WDYRPatchedClassComponent.prototype.render.apply(_assertThisInitialized(_assertThisInitialized(_this))); | ||
WDYRPatchedClassComponent.prototype.render.apply(_assertThisInitialized(_this)); | ||
return origRender(); | ||
@@ -560,5 +564,6 @@ }; | ||
Object.assign(WDYRPatchedClassComponent, ClassComponent, { | ||
displayName: displayName | ||
}); | ||
WDYRPatchedClassComponent.displayName = displayName; | ||
_defaults(WDYRPatchedClassComponent, ClassComponent); | ||
return WDYRPatchedClassComponent; | ||
@@ -586,5 +591,31 @@ } | ||
Object.assign(WDYRFunctionalComponent, FunctionalComponent, { | ||
displayName: displayName | ||
WDYRFunctionalComponent.displayName = displayName; | ||
_defaults(WDYRFunctionalComponent, FunctionalComponent); | ||
return WDYRFunctionalComponent; | ||
} | ||
function patchMemoComponent(MemoComponent, displayName, React, options) { | ||
var WDYRFunctionalComponent = React.memo(function (nextProps) { | ||
var prevCountRef = React.useRef(); | ||
var prevProps = prevCountRef.current; | ||
prevCountRef.current = nextProps; | ||
if (prevProps) { | ||
options.notifier(getUpdateInfo({ | ||
Component: MemoComponent, | ||
displayName: displayName, | ||
prevProps: prevProps, | ||
nextProps: nextProps, | ||
options: options | ||
})); | ||
} | ||
return MemoComponent.type(nextProps); | ||
}); | ||
WDYRFunctionalComponent.displayName = displayName; | ||
_defaults(WDYRFunctionalComponent, WDYRFunctionalComponent); | ||
return WDYRFunctionalComponent; | ||
@@ -594,2 +625,6 @@ } | ||
function createPatchedComponent(componentsMap, Component, displayName, React, options) { | ||
if (Component.$$typeof === REACT_MEMO_TYPE) { | ||
return patchMemoComponent(Component, displayName, React, options); | ||
} | ||
if (Component.prototype && Component.prototype.isReactComponent) { | ||
@@ -619,3 +654,3 @@ return patchClassComponent(Component, displayName, React, options); | ||
React.createElement = function (componentNameOrComponent) { | ||
var isShouldTrack = typeof componentNameOrComponent === 'function' && shouldTrack(componentNameOrComponent, getDisplayName(componentNameOrComponent), options); | ||
var isShouldTrack = (typeof componentNameOrComponent === 'function' || componentNameOrComponent.$$typeof === REACT_MEMO_TYPE) && shouldTrack(componentNameOrComponent, getDisplayName(componentNameOrComponent), options); | ||
@@ -622,0 +657,0 @@ for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { |
/** | ||
* @welldone-software/why-did-you-render 2.5.2 | ||
* @welldone-software/why-did-you-render 2.6.0 | ||
* MIT Licensed | ||
* Generated by Vitali Zaidman <vzaidman@gmail.com> (https://github.com/vzaidman) | ||
* Generated at 2019-02-12 | ||
* Generated at 2019-03-18 | ||
*/ | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var _isString=_interopDefault(require("lodash/isString")),_reduce=_interopDefault(require("lodash/reduce")),_keys=_interopDefault(require("lodash/keys")),_has=_interopDefault(require("lodash/has")),_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"));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 n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}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 _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){_defineProperty(e,t,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 n=_superPropBase(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(r):o.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"},moreInfoUrl="http://bit.ly/wdyr02",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}))))}function logDifference(e,t,r,n,o,i,f){o&&o.length>0?(f.consoleLog(_defineProperty({},t,e),"".concat(r," of ").concat(n," changes:")),o.forEach(function(e){var t=e.pathString,r=e.diffType,o=e.prevValue,i=e.nextValue;f.consoleGroup("%c".concat(n,".%c").concat(t,"%c"),"color:blue;","color:red;","color:black;"),f.consoleLog("".concat(diffTypesDescriptions[r]," (more info at ").concat(moreInfoUrl,")")),f.consoleLog(_defineProperty({},"prev ".concat(t),o),"!==",_defineProperty({},"next ".concat(t),i)),f.consoleGroupEnd()})):o&&(f.consoleLog(_defineProperty({},t,e),"".concat(r," the ").concat(n," object itself changed but it's values are all equal."),"props"===n?"This could of been avoided by making the component pure, or by preventing it's father from re-rendering.":"This usually means this component called setState when no changes in it's state actually occurred.","more info at ".concat(moreInfoUrl)),f.consoleLog("prev ".concat(n,":"),i.prev," !== ",i.next,":next ".concat(n)))}function defaultNotifier(e){var t=e.Component,r=e.displayName,n=e.prevProps,o=e.prevState,i=e.nextProps,f=e.nextState,a=e.reason,s=e.options;if(shouldLog(a,t,s)){s.consoleGroup("%c".concat(r),"color: #058;");var c="Re-rendered because";a.propsDifferences&&(logDifference(t,r,c,"props",a.propsDifferences,{prev:n,next:i},s),c="And because"),a.stateDifferences&&logDifference(t,r,c,"state",a.stateDifferences,{prev:o,next:f},s),a.propsDifferences||a.stateDifferences||s.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)),s.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),_objectSpread({include:null,exclude:null,notifier:e.notifier||createDefaultNotifier(e.hasOwnProperty("hotReloadBufferMs")?e.hotReloadBufferMs:500),onlyLogs:!1,consoleLog:console.log,consoleGroup:t,consoleGroupEnd:r,logOnDifferentValues:!1},e)}function getDisplayName(e){return e.displayName||e.name||(_isString(e)?e:void 0)}var hasElementType="undefined"!=typeof Element,hasSymbol="function"==typeof Symbol&&Symbol.for,REACT_ELEMENT_TYPE$1=hasSymbol?Symbol.for("react.element"):60103,isReactElement=function(e){return e.$$typeof===REACT_ELEMENT_TYPE$1};function trackDiff(e,t,r,n,o){return r.push({diffType:o,pathString:n,prevValue:e,nextValue:t}),o!==diffTypes.different}function accumulateDeepEqualDiffs(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";if(e===t)return!0;if(!e||!t)return trackDiff(e,t,r,n,diffTypes.different);if(_isArray(e)&&_isArray(t)){var o=e.length;if(o!==t.length)return trackDiff(e,t,r,n,diffTypes.different);for(var i=!0,f=o;0!=f--;)accumulateDeepEqualDiffs(e[f],t[f],r,"".concat(n,"[").concat(f,"]"))||(i=!1);return trackDiff(e,t,r,n,i?diffTypes.deepEquals:diffTypes.different)}if(_isDate(e)&&_isDate(t))return e.getTime()===t.getTime()?trackDiff(e,t,r,n,diffTypes.date):trackDiff(e,t,r,n,diffTypes.different);if(_isRegExp(e)&&_isRegExp(t))return e.toString()===t.toString()?trackDiff(e,t,r,n,diffTypes.regex):trackDiff(e,t,r,n,diffTypes.different);if(hasElementType&&e instanceof Element&&t instanceof Element)return trackDiff(e,t,r,n,diffTypes.different);if(isReactElement(e)&&isReactElement(t))return e.type===t.type?trackDiff(e,t,r,n,diffTypes.reactElement):trackDiff(e,t,r,n,diffTypes.different);if(_isFunction(e)&&_isFunction(t))return e.name===t.name?trackDiff(e,t,r,n,diffTypes.function):trackDiff(e,t,r,n,diffTypes.different);if(_isPlainObject(e)&&_isPlainObject(t)){var a=_keys(e),s=a.length;if(s!==_keys(t).length)return trackDiff(e,t,r,n,diffTypes.different);for(var c=s;0!=c--;)if(!_has(t,a[c]))return trackDiff(e,t,r,n,diffTypes.different);for(var u=!0,p=s;0!=p--;){var l=a[p];accumulateDeepEqualDiffs(e[l],t[l],r,"".concat(n,".").concat(l))||(u=!1)}return trackDiff(e,t,r,n,u?diffTypes.deepEquals:diffTypes.different)}return trackDiff(e,t,r,n,diffTypes.different)}function calculateDeepEqualDiffs(e,t,r){try{var n=[];return accumulateDeepEqualDiffs(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 emptyObject={};function findObjectsDifferences(e,t){if(e===t)return!1;var r=e||emptyObject,n=t||emptyObject,o=_keys(_objectSpread({},r,n));return _reduce(o,function(e,t){var o=calculateDeepEqualDiffs(r[t],n[t],t);return o&&(e=[].concat(_toConsumableArray(e||[]),_toConsumableArray(o))),e},[])}function getUpdateReason(e,t,r,n){return{propsDifferences:findObjectsDifferences(e,r,"props"),stateDifferences:findObjectsDifferences(t,n,"state")}}function getUpdateInfo(e){var t=e.Component,r=e.displayName,n=e.prevProps,o=e.prevState,i=e.nextProps,f=e.nextState;return{Component:t,displayName:r,prevProps:n,prevState:o,nextProps:i,nextState:f,options:e.options,reason:getUpdateReason(n,o,i,f)}}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))}function patchClassComponent(e,t,r,n){var o=function(r){function o(t,r){var n;if(_classCallCheck(this,o),(n=_possibleConstructorReturn(this,_getPrototypeOf(o).call(this,t,r))).render&&!e.prototype.render){var i=n.render;n.render=function(){return o.prototype.render.apply(_assertThisInitialized(_assertThisInitialized(n))),i()}}return n}return _inherits(o,e),_createClass(o,[{key:"render",value:function(){return this._prevProps&&n.notifier(getUpdateInfo({Component:e,displayName:t,prevProps:this._prevProps,prevState:this._prevState,nextProps:this.props,nextState:this.state,options:n})),this._prevProps=this.props,this._prevState=this.state,_get(_getPrototypeOf(o.prototype),"render",this)&&_get(_getPrototypeOf(o.prototype),"render",this).call(this)}}]),o}();return Object.assign(o,e,{displayName:t}),o}function patchFunctionalComponent(e,t,r,n){function o(o){var i=r.useRef(),f=i.current;return i.current=o,f&&n.notifier(getUpdateInfo({Component:e,displayName:t,prevProps:f,nextProps:o,options:n})),e(o)}return Object.assign(o,e,{displayName:t}),o}function createPatchedComponent(e,t,r,n,o){return t.prototype&&t.prototype.isReactComponent?patchClassComponent(t,r,n,o):patchFunctionalComponent(t,r,n,o)}function getPatchedComponent(e,t,r,n,o){if(e.has(t))return e.get(t);var i=createPatchedComponent(e,t,r,n,o);return e.set(t,i),i}function whyDidYouRender(e,t){var r=normalizeOptions(t),n=e.createElement,o=e.createFactory,i=new WeakMap;return e.createElement=function(t){for(var o="function"==typeof t&&shouldTrack(t,getDisplayName(t),r),f=arguments.length,a=new Array(f>1?f-1:0),s=1;s<f;s++)a[s-1]=arguments[s];if(!o)return n.apply(e,[t].concat(a));var c=t&&t.whyDidYouRender&&t.whyDidYouRender.customName||getDisplayName(t),u=getPatchedComponent(i,t,c,e,r);return n.apply(e,[u].concat(a))},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,o),e.__REVERT_WHY_DID_YOU_RENDER__=function(){e.createElement=n,e.createFactory=o,i=null,delete e.__REVERT_WHY_DID_YOU_RENDER__},e}module.exports=whyDidYouRender; | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var _defaults=_interopDefault(require("lodash/defaults")),_isString=_interopDefault(require("lodash/isString")),_reduce=_interopDefault(require("lodash/reduce")),_keys=_interopDefault(require("lodash/keys")),_has=_interopDefault(require("lodash/has")),_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"));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 n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}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 _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){_defineProperty(e,t,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 n=_superPropBase(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(r):o.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"},moreInfoUrl="http://bit.ly/wdyr02",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}))))}function logDifference(e,t,r,n,o,i,f){o&&o.length>0?(f.consoleLog(_defineProperty({},t,e),"".concat(r," of ").concat(n," changes:")),o.forEach(function(e){var t=e.pathString,r=e.diffType,o=e.prevValue,i=e.nextValue;f.consoleGroup("%c".concat(n,".%c").concat(t,"%c"),"color:blue;","color:red;","color:black;"),f.consoleLog("".concat(diffTypesDescriptions[r]," (more info at ").concat(moreInfoUrl,")")),f.consoleLog(_defineProperty({},"prev ".concat(t),o),"!==",_defineProperty({},"next ".concat(t),i)),f.consoleGroupEnd()})):o&&(f.consoleLog(_defineProperty({},t,e),"".concat(r," the ").concat(n," object itself changed but it's values are all equal."),"props"===n?"This could of been avoided by making the component pure, or by preventing it's father from re-rendering.":"This usually means this component called setState when no changes in it's state actually occurred.","more info at ".concat(moreInfoUrl)),f.consoleLog("prev ".concat(n,":"),i.prev," !== ",i.next,":next ".concat(n)))}function defaultNotifier(e){var t=e.Component,r=e.displayName,n=e.prevProps,o=e.prevState,i=e.nextProps,f=e.nextState,a=e.reason,s=e.options;if(shouldLog(a,t,s)){s.consoleGroup("%c".concat(r),"color: #058;");var c="Re-rendered because";a.propsDifferences&&(logDifference(t,r,c,"props",a.propsDifferences,{prev:n,next:i},s),c="And because"),a.stateDifferences&&logDifference(t,r,c,"state",a.stateDifferences,{prev:o,next:f},s),a.propsDifferences||a.stateDifferences||s.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)),s.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),_objectSpread({include:null,exclude:null,notifier:e.notifier||createDefaultNotifier(e.hasOwnProperty("hotReloadBufferMs")?e.hotReloadBufferMs:500),onlyLogs:!1,consoleLog:console.log,consoleGroup:t,consoleGroupEnd:r,logOnDifferentValues:!1},e)}function getDisplayName(e){return e.displayName||e.name||e.type&&getDisplayName(e.type)||(_isString(e)?e:void 0)}var hasElementType="undefined"!=typeof Element,hasSymbol="function"==typeof Symbol&&Symbol.for,REACT_ELEMENT_TYPE=hasSymbol?Symbol.for("react.element"):60103,isReactElement=function(e){return e.$$typeof===REACT_ELEMENT_TYPE};function trackDiff(e,t,r,n,o){return r.push({diffType:o,pathString:n,prevValue:e,nextValue:t}),o!==diffTypes.different}function accumulateDeepEqualDiffs(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";if(e===t)return!0;if(!e||!t)return trackDiff(e,t,r,n,diffTypes.different);if(_isArray(e)&&_isArray(t)){var o=e.length;if(o!==t.length)return trackDiff(e,t,r,n,diffTypes.different);for(var i=!0,f=o;0!=f--;)accumulateDeepEqualDiffs(e[f],t[f],r,"".concat(n,"[").concat(f,"]"))||(i=!1);return trackDiff(e,t,r,n,i?diffTypes.deepEquals:diffTypes.different)}if(_isDate(e)&&_isDate(t))return e.getTime()===t.getTime()?trackDiff(e,t,r,n,diffTypes.date):trackDiff(e,t,r,n,diffTypes.different);if(_isRegExp(e)&&_isRegExp(t))return e.toString()===t.toString()?trackDiff(e,t,r,n,diffTypes.regex):trackDiff(e,t,r,n,diffTypes.different);if(hasElementType&&e instanceof Element&&t instanceof Element)return trackDiff(e,t,r,n,diffTypes.different);if(isReactElement(e)&&isReactElement(t))return e.type===t.type?trackDiff(e,t,r,n,diffTypes.reactElement):trackDiff(e,t,r,n,diffTypes.different);if(_isFunction(e)&&_isFunction(t))return e.name===t.name?trackDiff(e,t,r,n,diffTypes.function):trackDiff(e,t,r,n,diffTypes.different);if(_isPlainObject(e)&&_isPlainObject(t)){var a=_keys(e),s=a.length;if(s!==_keys(t).length)return trackDiff(e,t,r,n,diffTypes.different);for(var c=s;0!=c--;)if(!_has(t,a[c]))return trackDiff(e,t,r,n,diffTypes.different);for(var p=!0,u=s;0!=u--;){var l=a[u];accumulateDeepEqualDiffs(e[l],t[l],r,"".concat(n,".").concat(l))||(p=!1)}return trackDiff(e,t,r,n,p?diffTypes.deepEquals:diffTypes.different)}return trackDiff(e,t,r,n,diffTypes.different)}function calculateDeepEqualDiffs(e,t,r){try{var n=[];return accumulateDeepEqualDiffs(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 emptyObject={};function findObjectsDifferences(e,t){if(e===t)return!1;var r=e||emptyObject,n=t||emptyObject,o=_keys(_objectSpread({},r,n));return _reduce(o,function(e,t){var o=calculateDeepEqualDiffs(r[t],n[t],t);return o&&(e=[].concat(_toConsumableArray(e||[]),_toConsumableArray(o))),e},[])}function getUpdateReason(e,t,r,n){return{propsDifferences:findObjectsDifferences(e,r,"props"),stateDifferences:findObjectsDifferences(t,n,"state")}}function getUpdateInfo(e){var t=e.Component,r=e.displayName,n=e.prevProps,o=e.prevState,i=e.nextProps,f=e.nextState;return{Component:t,displayName:r,prevProps:n,prevState:o,nextProps:i,nextState:f,options:e.options,reason:getUpdateReason(n,o,i,f)}}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 hasSymbol$1="function"==typeof Symbol&&Symbol.for,REACT_MEMO_TYPE=hasSymbol$1?Symbol.for("react.memo"):60115;function patchClassComponent(e,t,r,n){var o=function(r){function o(t,r){var n;if(_classCallCheck(this,o),(n=_possibleConstructorReturn(this,_getPrototypeOf(o).call(this,t,r))).render&&!e.prototype.render){var i=n.render;n.render=function(){return o.prototype.render.apply(_assertThisInitialized(n)),i()}}return n}return _inherits(o,e),_createClass(o,[{key:"render",value:function(){return this._prevProps&&n.notifier(getUpdateInfo({Component:e,displayName:t,prevProps:this._prevProps,prevState:this._prevState,nextProps:this.props,nextState:this.state,options:n})),this._prevProps=this.props,this._prevState=this.state,_get(_getPrototypeOf(o.prototype),"render",this)&&_get(_getPrototypeOf(o.prototype),"render",this).call(this)}}]),o}();return o.displayName=t,_defaults(o,e),o}function patchFunctionalComponent(e,t,r,n){function o(o){var i=r.useRef(),f=i.current;return i.current=o,f&&n.notifier(getUpdateInfo({Component:e,displayName:t,prevProps:f,nextProps:o,options:n})),e(o)}return o.displayName=t,_defaults(o,e),o}function patchMemoComponent(e,t,r,n){var o=r.memo(function(o){var i=r.useRef(),f=i.current;return i.current=o,f&&n.notifier(getUpdateInfo({Component:e,displayName:t,prevProps:f,nextProps:o,options:n})),e.type(o)});return o.displayName=t,_defaults(o,o),o}function createPatchedComponent(e,t,r,n,o){return t.$$typeof===REACT_MEMO_TYPE?patchMemoComponent(t,r,n,o):t.prototype&&t.prototype.isReactComponent?patchClassComponent(t,r,n,o):patchFunctionalComponent(t,r,n,o)}function getPatchedComponent(e,t,r,n,o){if(e.has(t))return e.get(t);var i=createPatchedComponent(e,t,r,n,o);return e.set(t,i),i}function whyDidYouRender(e,t){var r=normalizeOptions(t),n=e.createElement,o=e.createFactory,i=new WeakMap;return e.createElement=function(t){for(var o=("function"==typeof t||t.$$typeof===REACT_MEMO_TYPE)&&shouldTrack(t,getDisplayName(t),r),f=arguments.length,a=new Array(f>1?f-1:0),s=1;s<f;s++)a[s-1]=arguments[s];if(!o)return n.apply(e,[t].concat(a));var c=t&&t.whyDidYouRender&&t.whyDidYouRender.customName||getDisplayName(t),p=getPatchedComponent(i,t,c,e,r);return n.apply(e,[p].concat(a))},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,o),e.__REVERT_WHY_DID_YOU_RENDER__=function(){e.createElement=n,e.createFactory=o,i=null,delete e.__REVERT_WHY_DID_YOU_RENDER__},e}module.exports=whyDidYouRender; | ||
//# sourceMappingURL=whyDidYouRender.min.js.map |
/** | ||
* @welldone-software/why-did-you-render 2.5.2 | ||
* @welldone-software/why-did-you-render 2.6.0 | ||
* MIT Licensed | ||
* Generated by Vitali Zaidman <vzaidman@gmail.com> (https://github.com/vzaidman) | ||
* Generated at 2019-02-12 | ||
* Generated at 2019-03-18 | ||
*/ | ||
import _defaults from 'lodash/defaults'; | ||
import _isString from 'lodash/isString'; | ||
@@ -308,3 +309,3 @@ import _reduce from 'lodash/reduce'; | ||
function getDisplayName(type) { | ||
return type.displayName || type.name || (_isString(type) ? type : undefined); | ||
return type.displayName || type.name || type.type && getDisplayName(type.type) || (_isString(type) ? type : undefined); | ||
} | ||
@@ -315,6 +316,6 @@ | ||
var hasSymbol = typeof Symbol === 'function' && Symbol.for; | ||
var REACT_ELEMENT_TYPE$1 = hasSymbol ? Symbol.for('react.element') : 0xeac7; | ||
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7; | ||
var isReactElement = function isReactElement(object) { | ||
return object.$$typeof === REACT_ELEMENT_TYPE$1; | ||
return object.$$typeof === REACT_ELEMENT_TYPE; | ||
}; // end | ||
@@ -503,2 +504,5 @@ | ||
var hasSymbol$1 = typeof Symbol === 'function' && Symbol.for; | ||
var REACT_MEMO_TYPE = hasSymbol$1 ? Symbol.for('react.memo') : 0xead3; | ||
function patchClassComponent(ClassComponent, displayName, React, options) { | ||
@@ -522,3 +526,3 @@ var WDYRPatchedClassComponent = | ||
_this.render = function () { | ||
WDYRPatchedClassComponent.prototype.render.apply(_assertThisInitialized(_assertThisInitialized(_this))); | ||
WDYRPatchedClassComponent.prototype.render.apply(_assertThisInitialized(_this)); | ||
return origRender(); | ||
@@ -555,5 +559,6 @@ }; | ||
Object.assign(WDYRPatchedClassComponent, ClassComponent, { | ||
displayName: displayName | ||
}); | ||
WDYRPatchedClassComponent.displayName = displayName; | ||
_defaults(WDYRPatchedClassComponent, ClassComponent); | ||
return WDYRPatchedClassComponent; | ||
@@ -581,5 +586,31 @@ } | ||
Object.assign(WDYRFunctionalComponent, FunctionalComponent, { | ||
displayName: displayName | ||
WDYRFunctionalComponent.displayName = displayName; | ||
_defaults(WDYRFunctionalComponent, FunctionalComponent); | ||
return WDYRFunctionalComponent; | ||
} | ||
function patchMemoComponent(MemoComponent, displayName, React, options) { | ||
var WDYRFunctionalComponent = React.memo(function (nextProps) { | ||
var prevCountRef = React.useRef(); | ||
var prevProps = prevCountRef.current; | ||
prevCountRef.current = nextProps; | ||
if (prevProps) { | ||
options.notifier(getUpdateInfo({ | ||
Component: MemoComponent, | ||
displayName: displayName, | ||
prevProps: prevProps, | ||
nextProps: nextProps, | ||
options: options | ||
})); | ||
} | ||
return MemoComponent.type(nextProps); | ||
}); | ||
WDYRFunctionalComponent.displayName = displayName; | ||
_defaults(WDYRFunctionalComponent, WDYRFunctionalComponent); | ||
return WDYRFunctionalComponent; | ||
@@ -589,2 +620,6 @@ } | ||
function createPatchedComponent(componentsMap, Component, displayName, React, options) { | ||
if (Component.$$typeof === REACT_MEMO_TYPE) { | ||
return patchMemoComponent(Component, displayName, React, options); | ||
} | ||
if (Component.prototype && Component.prototype.isReactComponent) { | ||
@@ -614,3 +649,3 @@ return patchClassComponent(Component, displayName, React, options); | ||
React.createElement = function (componentNameOrComponent) { | ||
var isShouldTrack = typeof componentNameOrComponent === 'function' && shouldTrack(componentNameOrComponent, getDisplayName(componentNameOrComponent), options); | ||
var isShouldTrack = (typeof componentNameOrComponent === 'function' || componentNameOrComponent.$$typeof === REACT_MEMO_TYPE) && shouldTrack(componentNameOrComponent, getDisplayName(componentNameOrComponent), options); | ||
@@ -617,0 +652,0 @@ for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { |
/** | ||
* @welldone-software/why-did-you-render 2.5.2 | ||
* @welldone-software/why-did-you-render 2.6.0 | ||
* MIT Licensed | ||
* Generated by Vitali Zaidman <vzaidman@gmail.com> (https://github.com/vzaidman) | ||
* Generated at 2019-02-12 | ||
* Generated at 2019-03-18 | ||
*/ | ||
import e from"lodash/isString";import t from"lodash/reduce";import n from"lodash/keys";import r from"lodash/has";import o from"lodash/isFunction";import a from"lodash/isRegExp";import i from"lodash/isDate";import c from"lodash/isPlainObject";import f from"lodash/isArray";function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){s(e,t,n[t])})}return e}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e,t,n){return(h="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=p(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n):o.value}})(e,t,n||e)}function y(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(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 g,v={different:"different",deepEquals:"deepEquals",date:"date",regex:"regex",reactElement:"reactElement",function:"function"},b="http://bit.ly/wdyr02",E=(s(g={},v.different,"different objects."),s(g,v.deepEquals,"different objects that are equal by value."),s(g,v.date,"different date objects with the same value."),s(g,v.regex,"different regular expressions with the same value."),s(g,v.reactElement,"different React elements with the same displayName."),s(g,v.function,"different functions with the same name."),g),w=!1;function O(e,t,n,r,o,a,i){o&&o.length>0?(i.consoleLog(s({},t,e),"".concat(n," of ").concat(r," changes:")),o.forEach(function(e){var t=e.pathString,n=e.diffType,o=e.prevValue,a=e.nextValue;i.consoleGroup("%c".concat(r,".%c").concat(t,"%c"),"color:blue;","color:red;","color:black;"),i.consoleLog("".concat(E[n]," (more info at ").concat(b,")")),i.consoleLog(s({},"prev ".concat(t),o),"!==",s({},"next ".concat(t),a)),i.consoleGroupEnd()})):o&&(i.consoleLog(s({},t,e),"".concat(n," the ").concat(r," object itself changed but it's values are all equal."),"props"===r?"This could of been avoided by making the component pure, or by preventing it's father from re-rendering.":"This usually means this component called setState when no changes in it's state actually occurred.","more info at ".concat(b)),i.consoleLog("prev ".concat(r,":"),a.prev," !== ",a.next,":next ".concat(r)))}function D(e){var t=e.Component,n=e.displayName,r=e.prevProps,o=e.prevState,a=e.nextProps,i=e.nextState,c=e.reason,f=e.options;if(function(e,t,n){return!(w||!n.logOnDifferentValues&&(!t.whyDidYouRender||!t.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})))}(c,t,f)){f.consoleGroup("%c".concat(n),"color: #058;");var u="Re-rendered because";c.propsDifferences&&(O(t,n,u,"props",c.propsDifferences,{prev:r,next:a},f),u="And because"),c.stateDifferences&&O(t,n,u,"state",c.stateDifferences,{prev:o,next:i},f),c.propsDifferences||c.stateDifferences||f.consoleLog(s({},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(b)),f.consoleGroupEnd()}}var _=function(){};function x(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=console.group,r=console.groupEnd;return t.collapseGroups?n=console.groupCollapsed:t.onlyLogs&&(n=console.log,r=_),l({include:null,exclude:null,notifier:t.notifier||((e=t.hasOwnProperty("hotReloadBufferMs")?t.hotReloadBufferMs:500)&&module&&module.hot&&module.hot.addStatusHandler&&module.hot.addStatusHandler(function(t){"idle"===t&&(w=!0,setTimeout(function(){w=!1},e))}),D),onlyLogs:!1,consoleLog:console.log,consoleGroup:n,consoleGroupEnd:r,logOnDifferentValues:!1},t)}function j(t){return t.displayName||t.name||(e(t)?t:void 0)}var P="undefined"!=typeof Element,S="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103,R=function(e){return e.$$typeof===S};function T(e,t,n,r,o){return n.push({diffType:o,pathString:r,prevValue:e,nextValue:t}),o!==v.different}function N(e,t,u){try{var s=[];return function e(t,u,s){var l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";if(t===u)return!0;if(!t||!u)return T(t,u,s,l,v.different);if(f(t)&&f(u)){var p=t.length;if(p!==u.length)return T(t,u,s,l,v.different);for(var d=!0,m=p;0!=m--;)e(t[m],u[m],s,"".concat(l,"[").concat(m,"]"))||(d=!1);return T(t,u,s,l,d?v.deepEquals:v.different)}if(i(t)&&i(u))return t.getTime()===u.getTime()?T(t,u,s,l,v.date):T(t,u,s,l,v.different);if(a(t)&&a(u))return t.toString()===u.toString()?T(t,u,s,l,v.regex):T(t,u,s,l,v.different);if(P&&t instanceof Element&&u instanceof Element)return T(t,u,s,l,v.different);if(R(t)&&R(u))return t.type===u.type?T(t,u,s,l,v.reactElement):T(t,u,s,l,v.different);if(o(t)&&o(u))return t.name===u.name?T(t,u,s,l,v.function):T(t,u,s,l,v.different);if(c(t)&&c(u)){var h=n(t),y=h.length;if(y!==n(u).length)return T(t,u,s,l,v.different);for(var g=y;0!=g--;)if(!r(u,h[g]))return T(t,u,s,l,v.different);for(var b=!0,E=y;0!=E--;){var w=h[E];e(t[w],u[w],s,"".concat(l,".").concat(w))||(b=!1)}return T(t,u,s,l,b?v.deepEquals:v.different)}return T(t,u,s,l,v.different)}(e,t,s,u),s}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 L={};function V(e,r){if(e===r)return!1;var o=e||L,a=r||L,i=n(l({},o,a));return t(i,function(e,t){var n=N(o[t],a[t],t);return n&&(e=[].concat(y(e||[]),y(n))),e},[])}function Y(e,t,n,r){return{propsDifferences:V(e,n),stateDifferences:V(t,r)}}function k(e){var t=e.Component,n=e.displayName,r=e.prevProps,o=e.prevState,a=e.nextProps,i=e.nextState;return{Component:t,displayName:n,prevProps:r,prevState:o,nextProps:a,nextState:i,options:e.options,reason:Y(r,o,a,i)}}function A(e,t,n,r){var o=function(n){function o(t,n){var r,a,i;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),a=this,i=p(o).call(this,t,n),(r=!i||"object"!=typeof i&&"function"!=typeof i?m(a):i).render&&!e.prototype.render){var c=r.render;r.render=function(){return o.prototype.render.apply(m(m(r))),c()}}return r}var a,i,c;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&&d(e,t)}(o,e),a=o,(i=[{key:"render",value:function(){return this._prevProps&&r.notifier(k({Component:e,displayName:t,prevProps:this._prevProps,prevState:this._prevState,nextProps:this.props,nextState:this.state,options:r})),this._prevProps=this.props,this._prevState=this.state,h(p(o.prototype),"render",this)&&h(p(o.prototype),"render",this).call(this)}}])&&u(a.prototype,i),c&&u(a,c),o}();return Object.assign(o,e,{displayName:t}),o}function C(e,t,n,r,o){return t.prototype&&t.prototype.isReactComponent?A(t,n,0,o):function(e,t,n,r){function o(o){var a=n.useRef(),i=a.current;return a.current=o,i&&r.notifier(k({Component:e,displayName:t,prevProps:i,nextProps:o,options:r})),e(o)}return Object.assign(o,e,{displayName:t}),o}(t,n,r,o)}export default function(e,t){var n=x(t),r=e.createElement,o=e.createFactory,a=new WeakMap;return e.createElement=function(t){for(var o="function"==typeof t&&function(e,t,n){return!(function(e,t){return t.exclude&&t.exclude.length>0&&t.exclude.some(function(t){return t.test(e)})}(t,n)||!e.whyDidYouRender&&!function(e,t){return t.include&&t.include.length>0&&t.include.some(function(t){return t.test(e)})}(t,n))}(t,j(t),n),i=arguments.length,c=new Array(i>1?i-1:0),f=1;f<i;f++)c[f-1]=arguments[f];if(!o)return r.apply(e,[t].concat(c));var u=t&&t.whyDidYouRender&&t.whyDidYouRender.customName||j(t),s=function(e,t,n,r,o){if(e.has(t))return e.get(t);var a=C(0,t,n,r,o);return e.set(t,a),a}(a,t,u,e,n);return r.apply(e,[s].concat(c))},Object.assign(e.createElement,r),e.createFactory=function(t){var n=e.createElement.bind(null,t);return n.type=t,n},Object.assign(e.createFactory,o),e.__REVERT_WHY_DID_YOU_RENDER__=function(){e.createElement=r,e.createFactory=o,a=null,delete e.__REVERT_WHY_DID_YOU_RENDER__},e} | ||
import e from"lodash/defaults";import t from"lodash/isString";import n from"lodash/reduce";import r from"lodash/keys";import o from"lodash/has";import a from"lodash/isFunction";import i from"lodash/isRegExp";import c from"lodash/isDate";import f from"lodash/isPlainObject";import u from"lodash/isArray";function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){l(e,t,n[t])})}return e}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function m(e,t){return(m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e,t,n){return(h="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n):o.value}})(e,t,n||e)}function v(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(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 g,b={different:"different",deepEquals:"deepEquals",date:"date",regex:"regex",reactElement:"reactElement",function:"function"},E="http://bit.ly/wdyr02",w=(l(g={},b.different,"different objects."),l(g,b.deepEquals,"different objects that are equal by value."),l(g,b.date,"different date objects with the same value."),l(g,b.regex,"different regular expressions with the same value."),l(g,b.reactElement,"different React elements with the same displayName."),l(g,b.function,"different functions with the same name."),g),O=!1;function x(e,t,n,r,o,a,i){o&&o.length>0?(i.consoleLog(l({},t,e),"".concat(n," of ").concat(r," changes:")),o.forEach(function(e){var t=e.pathString,n=e.diffType,o=e.prevValue,a=e.nextValue;i.consoleGroup("%c".concat(r,".%c").concat(t,"%c"),"color:blue;","color:red;","color:black;"),i.consoleLog("".concat(w[n]," (more info at ").concat(E,")")),i.consoleLog(l({},"prev ".concat(t),o),"!==",l({},"next ".concat(t),a)),i.consoleGroupEnd()})):o&&(i.consoleLog(l({},t,e),"".concat(n," the ").concat(r," object itself changed but it's values are all equal."),"props"===r?"This could of been avoided by making the component pure, or by preventing it's father from re-rendering.":"This usually means this component called setState when no changes in it's state actually occurred.","more info at ".concat(E)),i.consoleLog("prev ".concat(r,":"),a.prev," !== ",a.next,":next ".concat(r)))}function D(e){var t=e.Component,n=e.displayName,r=e.prevProps,o=e.prevState,a=e.nextProps,i=e.nextState,c=e.reason,f=e.options;if(function(e,t,n){return!(O||!n.logOnDifferentValues&&(!t.whyDidYouRender||!t.whyDidYouRender.logOnDifferentValues)&&(e.propsDifferences&&e.propsDifferences.some(function(e){return e.diffType===b.different})||e.stateDifferences&&e.stateDifferences.some(function(e){return e.diffType===b.different})))}(c,t,f)){f.consoleGroup("%c".concat(n),"color: #058;");var u="Re-rendered because";c.propsDifferences&&(x(t,n,u,"props",c.propsDifferences,{prev:r,next:a},f),u="And because"),c.stateDifferences&&x(t,n,u,"state",c.stateDifferences,{prev:o,next:i},f),c.propsDifferences||c.stateDifferences||f.consoleLog(l({},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(E)),f.consoleGroupEnd()}}var S=function(){};function _(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=console.group,r=console.groupEnd;return t.collapseGroups?n=console.groupCollapsed:t.onlyLogs&&(n=console.log,r=S),p({include:null,exclude:null,notifier:t.notifier||((e=t.hasOwnProperty("hotReloadBufferMs")?t.hotReloadBufferMs:500)&&module&&module.hot&&module.hot.addStatusHandler&&module.hot.addStatusHandler(function(t){"idle"===t&&(O=!0,setTimeout(function(){O=!1},e))}),D),onlyLogs:!1,consoleLog:console.log,consoleGroup:n,consoleGroupEnd:r,logOnDifferentValues:!1},t)}function P(e){return e.displayName||e.name||e.type&&P(e.type)||(t(e)?e:void 0)}var R="undefined"!=typeof Element,j="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103,T=function(e){return e.$$typeof===j};function N(e,t,n,r,o){return n.push({diffType:o,pathString:r,prevValue:e,nextValue:t}),o!==b.different}function C(e,t,n){try{var s=[];return function e(t,n,s){var l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";if(t===n)return!0;if(!t||!n)return N(t,n,s,l,b.different);if(u(t)&&u(n)){var p=t.length;if(p!==n.length)return N(t,n,s,l,b.different);for(var d=!0,m=p;0!=m--;)e(t[m],n[m],s,"".concat(l,"[").concat(m,"]"))||(d=!1);return N(t,n,s,l,d?b.deepEquals:b.different)}if(c(t)&&c(n))return t.getTime()===n.getTime()?N(t,n,s,l,b.date):N(t,n,s,l,b.different);if(i(t)&&i(n))return t.toString()===n.toString()?N(t,n,s,l,b.regex):N(t,n,s,l,b.different);if(R&&t instanceof Element&&n instanceof Element)return N(t,n,s,l,b.different);if(T(t)&&T(n))return t.type===n.type?N(t,n,s,l,b.reactElement):N(t,n,s,l,b.different);if(a(t)&&a(n))return t.name===n.name?N(t,n,s,l,b.function):N(t,n,s,l,b.different);if(f(t)&&f(n)){var y=r(t),h=y.length;if(h!==r(n).length)return N(t,n,s,l,b.different);for(var v=h;0!=v--;)if(!o(n,y[v]))return N(t,n,s,l,b.different);for(var g=!0,E=h;0!=E--;){var w=y[E];e(t[w],n[w],s,"".concat(l,".").concat(w))||(g=!1)}return N(t,n,s,l,g?b.deepEquals:b.different)}return N(t,n,s,l,b.different)}(e,t,s,n),s}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 L={};function V(e,t){if(e===t)return!1;var o=e||L,a=t||L,i=r(p({},o,a));return n(i,function(e,t){var n=C(o[t],a[t],t);return n&&(e=[].concat(v(e||[]),v(n))),e},[])}function Y(e,t,n,r){return{propsDifferences:V(e,n),stateDifferences:V(t,r)}}function k(e){var t=e.Component,n=e.displayName,r=e.prevProps,o=e.prevState,a=e.nextProps,i=e.nextState;return{Component:t,displayName:n,prevProps:r,prevState:o,nextProps:a,nextState:i,options:e.options,reason:Y(r,o,a,i)}}var A="function"==typeof Symbol&&Symbol.for?Symbol.for("react.memo"):60115;function q(t,n,r,o){var a=function(e){function r(e,n){var o,a,i;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r),a=this,i=d(r).call(this,e,n),(o=!i||"object"!=typeof i&&"function"!=typeof i?y(a):i).render&&!t.prototype.render){var c=o.render;o.render=function(){return r.prototype.render.apply(y(o)),c()}}return o}var a,i,c;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&&m(e,t)}(r,t),a=r,(i=[{key:"render",value:function(){return this._prevProps&&o.notifier(k({Component:t,displayName:n,prevProps:this._prevProps,prevState:this._prevState,nextProps:this.props,nextState:this.state,options:o})),this._prevProps=this.props,this._prevState=this.state,h(d(r.prototype),"render",this)&&h(d(r.prototype),"render",this).call(this)}}])&&s(a.prototype,i),c&&s(a,c),r}();return a.displayName=n,e(a,t),a}function G(t,n,r,o,a){return n.$$typeof===A?function(t,n,r,o){var a=r.memo(function(e){var a=r.useRef(),i=a.current;return a.current=e,i&&o.notifier(k({Component:t,displayName:n,prevProps:i,nextProps:e,options:o})),t.type(e)});return a.displayName=n,e(a,a),a}(n,r,o,a):n.prototype&&n.prototype.isReactComponent?q(n,r,0,a):function(t,n,r,o){function a(e){var a=r.useRef(),i=a.current;return a.current=e,i&&o.notifier(k({Component:t,displayName:n,prevProps:i,nextProps:e,options:o})),t(e)}return a.displayName=n,e(a,t),a}(n,r,o,a)}export default function(e,t){var n=_(t),r=e.createElement,o=e.createFactory,a=new WeakMap;return e.createElement=function(t){for(var o=("function"==typeof t||t.$$typeof===A)&&function(e,t,n){return!(function(e,t){return t.exclude&&t.exclude.length>0&&t.exclude.some(function(t){return t.test(e)})}(t,n)||!e.whyDidYouRender&&!function(e,t){return t.include&&t.include.length>0&&t.include.some(function(t){return t.test(e)})}(t,n))}(t,P(t),n),i=arguments.length,c=new Array(i>1?i-1:0),f=1;f<i;f++)c[f-1]=arguments[f];if(!o)return r.apply(e,[t].concat(c));var u=t&&t.whyDidYouRender&&t.whyDidYouRender.customName||P(t),s=function(e,t,n,r,o){if(e.has(t))return e.get(t);var a=G(0,t,n,r,o);return e.set(t,a),a}(a,t,u,e,n);return r.apply(e,[s].concat(c))},Object.assign(e.createElement,r),e.createFactory=function(t){var n=e.createElement.bind(null,t);return n.type=t,n},Object.assign(e.createFactory,o),e.__REVERT_WHY_DID_YOU_RENDER__=function(){e.createElement=r,e.createFactory=o,a=null,delete e.__REVERT_WHY_DID_YOU_RENDER__},e} | ||
//# sourceMappingURL=whyDidYouRender.min.js.map |
/** | ||
* @welldone-software/why-did-you-render 2.5.2 | ||
* @welldone-software/why-did-you-render 2.6.0 | ||
* MIT Licensed | ||
* Generated by Vitali Zaidman <vzaidman@gmail.com> (https://github.com/vzaidman) | ||
* Generated at 2019-02-12 | ||
* Generated at 2019-03-18 | ||
*/ | ||
@@ -12,2 +12,3 @@ | ||
var _defaults = _interopDefault(require('lodash/defaults')); | ||
var _isString = _interopDefault(require('lodash/isString')); | ||
@@ -214,3 +215,3 @@ var _reduce = _interopDefault(require('lodash/reduce')); | ||
function getDisplayName(type) { | ||
return type.displayName || type.name || (_isString(type) ? type : undefined); | ||
return type.displayName || type.name || type.type && getDisplayName(type.type) || (_isString(type) ? type : undefined); | ||
} | ||
@@ -221,6 +222,6 @@ | ||
var hasSymbol = typeof Symbol === 'function' && Symbol.for; | ||
var REACT_ELEMENT_TYPE$1 = hasSymbol ? Symbol.for('react.element') : 0xeac7; | ||
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7; | ||
var isReactElement = function isReactElement(object) { | ||
return object.$$typeof === REACT_ELEMENT_TYPE$1; | ||
return object.$$typeof === REACT_ELEMENT_TYPE; | ||
}; // end | ||
@@ -409,2 +410,5 @@ | ||
var hasSymbol$1 = typeof Symbol === 'function' && Symbol.for; | ||
var REACT_MEMO_TYPE = hasSymbol$1 ? Symbol.for('react.memo') : 0xead3; | ||
function patchClassComponent(ClassComponent, displayName, React, options) { | ||
@@ -449,5 +453,6 @@ class WDYRPatchedClassComponent extends ClassComponent { | ||
Object.assign(WDYRPatchedClassComponent, ClassComponent, { | ||
displayName: displayName | ||
}); | ||
WDYRPatchedClassComponent.displayName = displayName; | ||
_defaults(WDYRPatchedClassComponent, ClassComponent); | ||
return WDYRPatchedClassComponent; | ||
@@ -475,5 +480,31 @@ } | ||
Object.assign(WDYRFunctionalComponent, FunctionalComponent, { | ||
displayName: displayName | ||
WDYRFunctionalComponent.displayName = displayName; | ||
_defaults(WDYRFunctionalComponent, FunctionalComponent); | ||
return WDYRFunctionalComponent; | ||
} | ||
function patchMemoComponent(MemoComponent, displayName, React, options) { | ||
var WDYRFunctionalComponent = React.memo(function (nextProps) { | ||
var prevCountRef = React.useRef(); | ||
var prevProps = prevCountRef.current; | ||
prevCountRef.current = nextProps; | ||
if (prevProps) { | ||
options.notifier(getUpdateInfo({ | ||
Component: MemoComponent, | ||
displayName: displayName, | ||
prevProps: prevProps, | ||
nextProps: nextProps, | ||
options: options | ||
})); | ||
} | ||
return MemoComponent.type(nextProps); | ||
}); | ||
WDYRFunctionalComponent.displayName = displayName; | ||
_defaults(WDYRFunctionalComponent, WDYRFunctionalComponent); | ||
return WDYRFunctionalComponent; | ||
@@ -483,2 +514,6 @@ } | ||
function createPatchedComponent(componentsMap, Component, displayName, React, options) { | ||
if (Component.$$typeof === REACT_MEMO_TYPE) { | ||
return patchMemoComponent(Component, displayName, React, options); | ||
} | ||
if (Component.prototype && Component.prototype.isReactComponent) { | ||
@@ -508,3 +543,3 @@ return patchClassComponent(Component, displayName, React, options); | ||
React.createElement = function (componentNameOrComponent) { | ||
var isShouldTrack = typeof componentNameOrComponent === 'function' && shouldTrack(componentNameOrComponent, getDisplayName(componentNameOrComponent), options); | ||
var isShouldTrack = (typeof componentNameOrComponent === 'function' || componentNameOrComponent.$$typeof === REACT_MEMO_TYPE) && shouldTrack(componentNameOrComponent, getDisplayName(componentNameOrComponent), options); | ||
@@ -511,0 +546,0 @@ for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { |
/** | ||
* @welldone-software/why-did-you-render 2.5.2 | ||
* @welldone-software/why-did-you-render 2.6.0 | ||
* MIT Licensed | ||
* Generated by Vitali Zaidman <vzaidman@gmail.com> (https://github.com/vzaidman) | ||
* Generated at 2019-02-12 | ||
* Generated at 2019-03-18 | ||
*/ | ||
import _defaults from 'lodash/defaults'; | ||
import _isString from 'lodash/isString'; | ||
@@ -209,3 +210,3 @@ import _reduce from 'lodash/reduce'; | ||
function getDisplayName(type) { | ||
return type.displayName || type.name || (_isString(type) ? type : undefined); | ||
return type.displayName || type.name || type.type && getDisplayName(type.type) || (_isString(type) ? type : undefined); | ||
} | ||
@@ -216,6 +217,6 @@ | ||
var hasSymbol = typeof Symbol === 'function' && Symbol.for; | ||
var REACT_ELEMENT_TYPE$1 = hasSymbol ? Symbol.for('react.element') : 0xeac7; | ||
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7; | ||
var isReactElement = function isReactElement(object) { | ||
return object.$$typeof === REACT_ELEMENT_TYPE$1; | ||
return object.$$typeof === REACT_ELEMENT_TYPE; | ||
}; // end | ||
@@ -404,2 +405,5 @@ | ||
var hasSymbol$1 = typeof Symbol === 'function' && Symbol.for; | ||
var REACT_MEMO_TYPE = hasSymbol$1 ? Symbol.for('react.memo') : 0xead3; | ||
function patchClassComponent(ClassComponent, displayName, React, options) { | ||
@@ -444,5 +448,6 @@ class WDYRPatchedClassComponent extends ClassComponent { | ||
Object.assign(WDYRPatchedClassComponent, ClassComponent, { | ||
displayName: displayName | ||
}); | ||
WDYRPatchedClassComponent.displayName = displayName; | ||
_defaults(WDYRPatchedClassComponent, ClassComponent); | ||
return WDYRPatchedClassComponent; | ||
@@ -470,5 +475,31 @@ } | ||
Object.assign(WDYRFunctionalComponent, FunctionalComponent, { | ||
displayName: displayName | ||
WDYRFunctionalComponent.displayName = displayName; | ||
_defaults(WDYRFunctionalComponent, FunctionalComponent); | ||
return WDYRFunctionalComponent; | ||
} | ||
function patchMemoComponent(MemoComponent, displayName, React, options) { | ||
var WDYRFunctionalComponent = React.memo(function (nextProps) { | ||
var prevCountRef = React.useRef(); | ||
var prevProps = prevCountRef.current; | ||
prevCountRef.current = nextProps; | ||
if (prevProps) { | ||
options.notifier(getUpdateInfo({ | ||
Component: MemoComponent, | ||
displayName: displayName, | ||
prevProps: prevProps, | ||
nextProps: nextProps, | ||
options: options | ||
})); | ||
} | ||
return MemoComponent.type(nextProps); | ||
}); | ||
WDYRFunctionalComponent.displayName = displayName; | ||
_defaults(WDYRFunctionalComponent, WDYRFunctionalComponent); | ||
return WDYRFunctionalComponent; | ||
@@ -478,2 +509,6 @@ } | ||
function createPatchedComponent(componentsMap, Component, displayName, React, options) { | ||
if (Component.$$typeof === REACT_MEMO_TYPE) { | ||
return patchMemoComponent(Component, displayName, React, options); | ||
} | ||
if (Component.prototype && Component.prototype.isReactComponent) { | ||
@@ -503,3 +538,3 @@ return patchClassComponent(Component, displayName, React, options); | ||
React.createElement = function (componentNameOrComponent) { | ||
var isShouldTrack = typeof componentNameOrComponent === 'function' && shouldTrack(componentNameOrComponent, getDisplayName(componentNameOrComponent), options); | ||
var isShouldTrack = (typeof componentNameOrComponent === 'function' || componentNameOrComponent.$$typeof === REACT_MEMO_TYPE) && shouldTrack(componentNameOrComponent, getDisplayName(componentNameOrComponent), options); | ||
@@ -506,0 +541,0 @@ for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { |
/** | ||
* @welldone-software/why-did-you-render 2.5.2 | ||
* @welldone-software/why-did-you-render 2.6.0 | ||
* MIT Licensed | ||
* Generated by Vitali Zaidman <vzaidman@gmail.com> (https://github.com/vzaidman) | ||
* Generated at 2019-02-12 | ||
* Generated at 2019-03-18 | ||
*/ | ||
!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){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(r){t(e,r,n[r])})}return e}function n(e){return(n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function i(e,t,r){return(i="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var o=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=n(e)););return e}(e,t);if(o){var a=Object.getOwnPropertyDescriptor(o,t);return a.get?a.get.call(r):a.value}})(e,t,r||e)}function u(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 c,f={different:"different",deepEquals:"deepEquals",date:"date",regex:"regex",reactElement:"reactElement",function:"function"},s="http://bit.ly/wdyr02",l=(t(c={},f.different,"different objects."),t(c,f.deepEquals,"different objects that are equal by value."),t(c,f.date,"different date objects with the same value."),t(c,f.regex,"different regular expressions with the same value."),t(c,f.reactElement,"different React elements with the same displayName."),t(c,f.function,"different functions with the same name."),c),p=!1;function v(e,r,n,o,a,i,u){a&&a.length>0?(u.consoleLog(t({},r,e),"".concat(n," of ").concat(o," changes:")),a.forEach(function(e){var r=e.pathString,n=e.diffType,a=e.prevValue,i=e.nextValue;u.consoleGroup("%c".concat(o,".%c").concat(r,"%c"),"color:blue;","color:red;","color:black;"),u.consoleLog("".concat(l[n]," (more info at ").concat(s,")")),u.consoleLog(t({},"prev ".concat(r),a),"!==",t({},"next ".concat(r),i)),u.consoleGroupEnd()})):a&&(u.consoleLog(t({},r,e),"".concat(n," the ").concat(o," object itself changed but it's values are all equal."),"props"===o?"This could of been avoided by making the component pure, or by preventing it's father from re-rendering.":"This usually means this component called setState when no changes in it's state actually occurred.","more info at ".concat(s)),u.consoleLog("prev ".concat(o,":"),i.prev," !== ",i.next,":next ".concat(o)))}function h(e){var r=e.Component,n=e.displayName,o=e.prevProps,a=e.prevState,i=e.nextProps,u=e.nextState,c=e.reason,l=e.options;if(function(e,t,r){return!(p||!r.logOnDifferentValues&&(!t.whyDidYouRender||!t.whyDidYouRender.logOnDifferentValues)&&(e.propsDifferences&&e.propsDifferences.some(function(e){return e.diffType===f.different})||e.stateDifferences&&e.stateDifferences.some(function(e){return e.diffType===f.different})))}(c,r,l)){l.consoleGroup("%c".concat(n),"color: #058;");var h="Re-rendered because";c.propsDifferences&&(v(r,n,h,"props",c.propsDifferences,{prev:o,next:i},l),h="And because"),c.stateDifferences&&v(r,n,h,"state",c.stateDifferences,{prev:a,next:u},l),c.propsDifferences||c.stateDifferences||l.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(s)),l.consoleGroupEnd()}}var d=function(){};function y(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=console.group,o=console.groupEnd;return t.collapseGroups?n=console.groupCollapsed:t.onlyLogs&&(n=console.log,o=d),r({include:null,exclude:null,notifier:t.notifier||((e=t.hasOwnProperty("hotReloadBufferMs")?t.hotReloadBufferMs:500)&&module&&module.hot&&module.hot.addStatusHandler&&module.hot.addStatusHandler(function(t){"idle"===t&&(p=!0,setTimeout(function(){p=!1},e))}),h),onlyLogs:!1,consoleLog:console.log,consoleGroup:n,consoleGroupEnd:o,logOnDifferentValues:!1},t)}var b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function g(e,t){return e(t={exports:{}},t.exports),t.exports}var _="object"==typeof b&&b&&b.Object===Object&&b,j="object"==typeof self&&self&&self.Object===Object&&self,m=_||j||Function("return this")(),O=m.Symbol,w=Object.prototype,E=w.hasOwnProperty,S=w.toString,P=O?O.toStringTag:void 0;var x=function(e){var t=E.call(e,P),r=e[P];try{e[P]=void 0;var n=!0}catch(e){}var o=S.call(e);return n&&(t?e[P]=r:delete e[P]),o},D=Object.prototype.toString;var A=function(e){return D.call(e)},R="[object Null]",z="[object Undefined]",T=O?O.toStringTag:void 0;var k=function(e){return null==e?void 0===e?z:R:T&&T in Object(e)?x(e):A(e)},N=Array.isArray;var F=function(e){return null!=e&&"object"==typeof e},L="[object String]";var V=function(e){return"string"==typeof e||!N(e)&&F(e)&&k(e)==L};function C(e){return e.displayName||e.name||(V(e)?e:void 0)}var M=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 $=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 Y=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n},q="[object Arguments]";var B=function(e){return F(e)&&k(e)==q},I=Object.prototype,U=I.hasOwnProperty,G=I.propertyIsEnumerable,W=B(function(){return arguments}())?B:function(e){return F(e)&&U.call(e,"callee")&&!G.call(e,"callee")};var H=function(){return!1},J=g(function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,o=n&&n.exports===r?m.Buffer:void 0,a=(o?o.isBuffer:void 0)||H;e.exports=a}),K=9007199254740991,Q=/^(?:0|[1-9]\d*)$/;var X=function(e,t){var r=typeof e;return!!(t=null==t?K:t)&&("number"==r||"symbol"!=r&&Q.test(e))&&e>-1&&e%1==0&&e<t},Z=9007199254740991;var ee=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=Z},te={};te["[object Float32Array]"]=te["[object Float64Array]"]=te["[object Int8Array]"]=te["[object Int16Array]"]=te["[object Int32Array]"]=te["[object Uint8Array]"]=te["[object Uint8ClampedArray]"]=te["[object Uint16Array]"]=te["[object Uint32Array]"]=!0,te["[object Arguments]"]=te["[object Array]"]=te["[object ArrayBuffer]"]=te["[object Boolean]"]=te["[object DataView]"]=te["[object Date]"]=te["[object Error]"]=te["[object Function]"]=te["[object Map]"]=te["[object Number]"]=te["[object Object]"]=te["[object RegExp]"]=te["[object Set]"]=te["[object String]"]=te["[object WeakMap]"]=!1;var re=function(e){return F(e)&&ee(e.length)&&!!te[k(e)]};var ne=function(e){return function(t){return e(t)}},oe=g(function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,o=n&&n.exports===r&&_.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}),ae=oe&&oe.isTypedArray,ie=ae?ne(ae):re,ue=Object.prototype.hasOwnProperty;var ce=function(e,t){var r=N(e),n=!r&&W(e),o=!r&&!n&&J(e),a=!r&&!n&&!o&&ie(e),i=r||n||o||a,u=i?Y(e.length,String):[],c=u.length;for(var f in e)!t&&!ue.call(e,f)||i&&("length"==f||o&&("offset"==f||"parent"==f)||a&&("buffer"==f||"byteLength"==f||"byteOffset"==f)||X(f,c))||u.push(f);return u},fe=Object.prototype;var se=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||fe)};var le=function(e,t){return function(r){return e(t(r))}},pe=le(Object.keys,Object),ve=Object.prototype.hasOwnProperty;var he=function(e){if(!se(e))return pe(e);var t=[];for(var r in Object(e))ve.call(e,r)&&"constructor"!=r&&t.push(r);return t};var de=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},ye="[object AsyncFunction]",be="[object Function]",ge="[object GeneratorFunction]",_e="[object Proxy]";var je=function(e){if(!de(e))return!1;var t=k(e);return t==be||t==ge||t==ye||t==_e};var me=function(e){return null!=e&&ee(e.length)&&!je(e)};var Oe=function(e){return me(e)?ce(e):he(e)};var we=function(e,t){return function(r,n){if(null==r)return r;if(!me(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}}(function(e,t){return e&&$(e,t,Oe)});var Ee=function(){this.__data__=[],this.size=0};var Se=function(e,t){return e===t||e!=e&&t!=t};var Pe=function(e,t){for(var r=e.length;r--;)if(Se(e[r][0],t))return r;return-1},xe=Array.prototype.splice;var De=function(e){var t=this.__data__,r=Pe(t,e);return!(r<0||(r==t.length-1?t.pop():xe.call(t,r,1),--this.size,0))};var Ae=function(e){var t=this.__data__,r=Pe(t,e);return r<0?void 0:t[r][1]};var Re=function(e){return Pe(this.__data__,e)>-1};var ze=function(e,t){var r=this.__data__,n=Pe(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};function Te(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])}}Te.prototype.clear=Ee,Te.prototype.delete=De,Te.prototype.get=Ae,Te.prototype.has=Re,Te.prototype.set=ze;var ke=Te;var Ne=function(){this.__data__=new ke,this.size=0};var Fe=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r};var Le=function(e){return this.__data__.get(e)};var Ve,Ce=function(e){return this.__data__.has(e)},Me=m["__core-js_shared__"],$e=(Ve=/[^.]+$/.exec(Me&&Me.keys&&Me.keys.IE_PROTO||""))?"Symbol(src)_1."+Ve:"";var Ye=function(e){return!!$e&&$e in e},qe=Function.prototype.toString;var Be=function(e){if(null!=e){try{return qe.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Ie=/^\[object .+?Constructor\]$/,Ue=Function.prototype,Ge=Object.prototype,We=Ue.toString,He=Ge.hasOwnProperty,Je=RegExp("^"+We.call(He).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Ke=function(e){return!(!de(e)||Ye(e))&&(je(e)?Je:Ie).test(Be(e))};var Qe=function(e,t){return null==e?void 0:e[t]};var Xe=function(e,t){var r=Qe(e,t);return Ke(r)?r:void 0},Ze=Xe(m,"Map"),et=Xe(Object,"create");var tt=function(){this.__data__=et?et(null):{},this.size=0};var rt=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},nt="__lodash_hash_undefined__",ot=Object.prototype.hasOwnProperty;var at=function(e){var t=this.__data__;if(et){var r=t[e];return r===nt?void 0:r}return ot.call(t,e)?t[e]:void 0},it=Object.prototype.hasOwnProperty;var ut=function(e){var t=this.__data__;return et?void 0!==t[e]:it.call(t,e)},ct="__lodash_hash_undefined__";var ft=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=et&&void 0===t?ct:t,this};function st(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])}}st.prototype.clear=tt,st.prototype.delete=rt,st.prototype.get=at,st.prototype.has=ut,st.prototype.set=ft;var lt=st;var pt=function(){this.size=0,this.__data__={hash:new lt,map:new(Ze||ke),string:new lt}};var vt=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var ht=function(e,t){var r=e.__data__;return vt(t)?r["string"==typeof t?"string":"hash"]:r.map};var dt=function(e){var t=ht(this,e).delete(e);return this.size-=t?1:0,t};var yt=function(e){return ht(this,e).get(e)};var bt=function(e){return ht(this,e).has(e)};var gt=function(e,t){var r=ht(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};function _t(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])}}_t.prototype.clear=pt,_t.prototype.delete=dt,_t.prototype.get=yt,_t.prototype.has=bt,_t.prototype.set=gt;var jt=_t,mt=200;var Ot=function(e,t){var r=this.__data__;if(r instanceof ke){var n=r.__data__;if(!Ze||n.length<mt-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new jt(n)}return r.set(e,t),this.size=r.size,this};function wt(e){var t=this.__data__=new ke(e);this.size=t.size}wt.prototype.clear=Ne,wt.prototype.delete=Fe,wt.prototype.get=Le,wt.prototype.has=Ce,wt.prototype.set=Ot;var Et=wt,St="__lodash_hash_undefined__";var Pt=function(e){return this.__data__.set(e,St),this};var xt=function(e){return this.__data__.has(e)};function Dt(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new jt;++t<r;)this.add(e[t])}Dt.prototype.add=Dt.prototype.push=Pt,Dt.prototype.has=xt;var At=Dt;var Rt=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 zt=function(e,t){return e.has(t)},Tt=1,kt=2;var Nt=function(e,t,r,n,o,a){var i=r&Tt,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&kt?new At:void 0;for(a.set(e,t),a.set(t,e);++s<u;){var v=e[s],h=t[s];if(n)var d=i?n(h,v,s,t,e,a):n(v,h,s,e,t,a);if(void 0!==d){if(d)continue;l=!1;break}if(p){if(!Rt(t,function(e,t){if(!zt(p,t)&&(v===e||o(v,e,r,n,a)))return p.push(t)})){l=!1;break}}else if(v!==h&&!o(v,h,r,n,a)){l=!1;break}}return a.delete(e),a.delete(t),l},Ft=m.Uint8Array;var Lt=function(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r};var Vt=function(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r},Ct=1,Mt=2,$t="[object Boolean]",Yt="[object Date]",qt="[object Error]",Bt="[object Map]",It="[object Number]",Ut="[object RegExp]",Gt="[object Set]",Wt="[object String]",Ht="[object Symbol]",Jt="[object ArrayBuffer]",Kt="[object DataView]",Qt=O?O.prototype:void 0,Xt=Qt?Qt.valueOf:void 0;var Zt=function(e,t,r,n,o,a,i){switch(r){case Kt:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Jt:return!(e.byteLength!=t.byteLength||!a(new Ft(e),new Ft(t)));case $t:case Yt:case It:return Se(+e,+t);case qt:return e.name==t.name&&e.message==t.message;case Ut:case Wt:return e==t+"";case Bt:var u=Lt;case Gt:var c=n&Ct;if(u||(u=Vt),e.size!=t.size&&!c)return!1;var f=i.get(e);if(f)return f==t;n|=Mt,i.set(e,t);var s=Nt(u(e),u(t),n,o,a,i);return i.delete(e),s;case Ht:if(Xt)return Xt.call(e)==Xt.call(t)}return!1};var er=function(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e};var tr=function(e,t,r){var n=t(e);return N(e)?n:er(n,r(e))};var rr=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 nr=function(){return[]},or=Object.prototype.propertyIsEnumerable,ar=Object.getOwnPropertySymbols,ir=ar?function(e){return null==e?[]:(e=Object(e),rr(ar(e),function(t){return or.call(e,t)}))}:nr;var ur=function(e){return tr(e,Oe,ir)},cr=1,fr=Object.prototype.hasOwnProperty;var sr=function(e,t,r,n,o,a){var i=r&cr,u=ur(e),c=u.length;if(c!=ur(t).length&&!i)return!1;for(var f=c;f--;){var s=u[f];if(!(i?s in t:fr.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 h=e[s=u[f]],d=t[s];if(n)var y=i?n(d,h,s,t,e,a):n(h,d,s,e,t,a);if(!(void 0===y?h===d||o(h,d,r,n,a):y)){p=!1;break}v||(v="constructor"==s)}if(p&&!v){var b=e.constructor,g=t.constructor;b!=g&&"constructor"in e&&"constructor"in t&&!("function"==typeof b&&b instanceof b&&"function"==typeof g&&g instanceof g)&&(p=!1)}return a.delete(e),a.delete(t),p},lr=Xe(m,"DataView"),pr=Xe(m,"Promise"),vr=Xe(m,"Set"),hr=Xe(m,"WeakMap"),dr=Be(lr),yr=Be(Ze),br=Be(pr),gr=Be(vr),_r=Be(hr),jr=k;(lr&&"[object DataView]"!=jr(new lr(new ArrayBuffer(1)))||Ze&&"[object Map]"!=jr(new Ze)||pr&&"[object Promise]"!=jr(pr.resolve())||vr&&"[object Set]"!=jr(new vr)||hr&&"[object WeakMap]"!=jr(new hr))&&(jr=function(e){var t=k(e),r="[object Object]"==t?e.constructor:void 0,n=r?Be(r):"";if(n)switch(n){case dr:return"[object DataView]";case yr:return"[object Map]";case br:return"[object Promise]";case gr:return"[object Set]";case _r:return"[object WeakMap]"}return t});var mr=jr,Or=1,wr="[object Arguments]",Er="[object Array]",Sr="[object Object]",Pr=Object.prototype.hasOwnProperty;var xr=function(e,t,r,n,o,a){var i=N(e),u=N(t),c=i?Er:mr(e),f=u?Er:mr(t),s=(c=c==wr?Sr:c)==Sr,l=(f=f==wr?Sr:f)==Sr,p=c==f;if(p&&J(e)){if(!J(t))return!1;i=!0,s=!1}if(p&&!s)return a||(a=new Et),i||ie(e)?Nt(e,t,r,n,o,a):Zt(e,t,c,r,n,o,a);if(!(r&Or)){var v=s&&Pr.call(e,"__wrapped__"),h=l&&Pr.call(t,"__wrapped__");if(v||h){var d=v?e.value():e,y=h?t.value():t;return a||(a=new Et),o(d,y,r,n,a)}}return!!p&&(a||(a=new Et),sr(e,t,r,n,o,a))};var Dr=function e(t,r,n,o,a){return t===r||(null==t||null==r||!F(t)&&!F(r)?t!=t&&r!=r:xr(t,r,n,o,e,a))},Ar=1,Rr=2;var zr=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 Et;if(n)var p=n(f,s,c,e,t,l);if(!(void 0===p?Dr(s,f,Ar|Rr,n,l):p))return!1}}return!0};var Tr=function(e){return e==e&&!de(e)};var kr=function(e){for(var t=Oe(e),r=t.length;r--;){var n=t[r],o=e[n];t[r]=[n,o,Tr(o)]}return t};var Nr=function(e,t){return function(r){return null!=r&&r[e]===t&&(void 0!==t||e in Object(r))}};var Fr=function(e){var t=kr(e);return 1==t.length&&t[0][2]?Nr(t[0][0],t[0][1]):function(r){return r===e||zr(r,e,t)}},Lr="[object Symbol]";var Vr=function(e){return"symbol"==typeof e||F(e)&&k(e)==Lr},Cr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Mr=/^\w*$/;var $r=function(e,t){if(N(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!Vr(e))||Mr.test(e)||!Cr.test(e)||null!=t&&e in Object(t)},Yr="Expected a function";function qr(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(Yr);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(qr.Cache||jt),r}qr.Cache=jt;var Br=qr,Ir=500;var Ur=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Gr=/\\(\\)?/g,Wr=function(e){var t=Br(e,function(e){return r.size===Ir&&r.clear(),e}),r=t.cache;return t}(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Ur,function(e,r,n,o){t.push(n?o.replace(Gr,"$1"):r||e)}),t});var Hr=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},Jr=1/0,Kr=O?O.prototype:void 0,Qr=Kr?Kr.toString:void 0;var Xr=function e(t){if("string"==typeof t)return t;if(N(t))return Hr(t,e)+"";if(Vr(t))return Qr?Qr.call(t):"";var r=t+"";return"0"==r&&1/t==-Jr?"-0":r};var Zr=function(e){return null==e?"":Xr(e)};var en=function(e,t){return N(e)?e:$r(e,t)?[e]:Wr(Zr(e))},tn=1/0;var rn=function(e){if("string"==typeof e||Vr(e))return e;var t=e+"";return"0"==t&&1/e==-tn?"-0":t};var nn=function(e,t){for(var r=0,n=(t=en(t,e)).length;null!=e&&r<n;)e=e[rn(t[r++])];return r&&r==n?e:void 0};var on=function(e,t,r){var n=null==e?void 0:nn(e,t);return void 0===n?r:n};var an=function(e,t){return null!=e&&t in Object(e)};var un=function(e,t,r){for(var n=-1,o=(t=en(t,e)).length,a=!1;++n<o;){var i=rn(t[n]);if(!(a=null!=e&&r(e,i)))break;e=e[i]}return a||++n!=o?a:!!(o=null==e?0:e.length)&&ee(o)&&X(i,o)&&(N(e)||W(e))};var cn=function(e,t){return null!=e&&un(e,t,an)},fn=1,sn=2;var ln=function(e,t){return $r(e)&&Tr(t)?Nr(rn(e),t):function(r){var n=on(r,e);return void 0===n&&n===t?cn(r,e):Dr(t,n,fn|sn)}};var pn=function(e){return e};var vn=function(e){return function(t){return null==t?void 0:t[e]}};var hn=function(e){return function(t){return nn(t,e)}};var dn=function(e){return $r(e)?vn(rn(e)):hn(e)};var yn=function(e){return"function"==typeof e?e:null==e?pn:"object"==typeof e?N(e)?ln(e[0],e[1]):Fr(e):dn(e)};var bn=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 gn=function(e,t,r){var n=N(e)?M:bn,o=arguments.length<3;return n(e,yn(t,4),r,o,we)},_n=Object.prototype.hasOwnProperty;var jn=function(e,t){return null!=e&&_n.call(e,t)};var mn=function(e,t){return null!=e&&un(e,t,jn)},On="[object RegExp]";var wn=function(e){return F(e)&&k(e)==On},En=oe&&oe.isRegExp,Sn=En?ne(En):wn,Pn="[object Date]";var xn=function(e){return F(e)&&k(e)==Pn},Dn=oe&&oe.isDate,An=Dn?ne(Dn):xn,Rn=le(Object.getPrototypeOf,Object),zn="[object Object]",Tn=Function.prototype,kn=Object.prototype,Nn=Tn.toString,Fn=kn.hasOwnProperty,Ln=Nn.call(Object);var Vn=function(e){if(!F(e)||k(e)!=zn)return!1;var t=Rn(e);if(null===t)return!0;var r=Fn.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&Nn.call(r)==Ln},Cn="undefined"!=typeof Element,Mn="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103,$n=function(e){return e.$$typeof===Mn};function Yn(e,t,r,n,o){return r.push({diffType:o,pathString:n,prevValue:e,nextValue:t}),o!==f.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 Yn(t,r,n,o,f.different);if(N(t)&&N(r)){var a=t.length;if(a!==r.length)return Yn(t,r,n,o,f.different);for(var i=!0,u=a;0!=u--;)e(t[u],r[u],n,"".concat(o,"[").concat(u,"]"))||(i=!1);return Yn(t,r,n,o,i?f.deepEquals:f.different)}if(An(t)&&An(r))return t.getTime()===r.getTime()?Yn(t,r,n,o,f.date):Yn(t,r,n,o,f.different);if(Sn(t)&&Sn(r))return t.toString()===r.toString()?Yn(t,r,n,o,f.regex):Yn(t,r,n,o,f.different);if(Cn&&t instanceof Element&&r instanceof Element)return Yn(t,r,n,o,f.different);if($n(t)&&$n(r))return t.type===r.type?Yn(t,r,n,o,f.reactElement):Yn(t,r,n,o,f.different);if(je(t)&&je(r))return t.name===r.name?Yn(t,r,n,o,f.function):Yn(t,r,n,o,f.different);if(Vn(t)&&Vn(r)){var c=Oe(t),s=c.length;if(s!==Oe(r).length)return Yn(t,r,n,o,f.different);for(var l=s;0!=l--;)if(!mn(r,c[l]))return Yn(t,r,n,o,f.different);for(var p=!0,v=s;0!=v--;){var h=c[v];e(t[h],r[h],n,"".concat(o,".").concat(h))||(p=!1)}return Yn(t,r,n,o,p?f.deepEquals:f.different)}return Yn(t,r,n,o,f.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 Bn={};function In(e,t){if(e===t)return!1;var n=e||Bn,o=t||Bn,a=Oe(r({},n,o));return gn(a,function(e,t){var r=qn(n[t],o[t],t);return r&&(e=[].concat(u(e||[]),u(r))),e},[])}function Un(e,t,r,n){return{propsDifferences:In(e,r),stateDifferences:In(t,n)}}function Gn(e){var t=e.Component,r=e.displayName,n=e.prevProps,o=e.prevState,a=e.nextProps,i=e.nextState;return{Component:t,displayName:r,prevProps:n,prevState:o,nextProps:a,nextState:i,options:e.options,reason:Un(n,o,a,i)}}function Wn(t,r,u,c){var f=function(u){function f(e,r){var o,i,u;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,f),i=this,u=n(f).call(this,e,r),(o=!u||"object"!=typeof u&&"function"!=typeof u?a(i):u).render&&!t.prototype.render){var c=o.render;o.render=function(){return f.prototype.render.apply(a(a(o))),c()}}return o}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&&o(e,t)}(f,t),s=f,(l=[{key:"render",value:function(){return this._prevProps&&c.notifier(Gn({Component:t,displayName:r,prevProps:this._prevProps,prevState:this._prevState,nextProps:this.props,nextState:this.state,options:c})),this._prevProps=this.props,this._prevState=this.state,i(n(f.prototype),"render",this)&&i(n(f.prototype),"render",this).call(this)}}])&&e(s.prototype,l),p&&e(s,p),f}();return Object.assign(f,t,{displayName:r}),f}function Hn(e,t,r,n,o){return t.prototype&&t.prototype.isReactComponent?Wn(t,r,0,o):function(e,t,r,n){function o(o){var a=r.useRef(),i=a.current;return a.current=o,i&&n.notifier(Gn({Component:e,displayName:t,prevProps:i,nextProps:o,options:n})),e(o)}return Object.assign(o,e,{displayName:t}),o}(t,r,n,o)}return function(e,t){var r=y(t),n=e.createElement,o=e.createFactory,a=new WeakMap;return e.createElement=function(t){for(var o="function"==typeof t&&function(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))}(t,C(t),r),i=arguments.length,u=new Array(i>1?i-1:0),c=1;c<i;c++)u[c-1]=arguments[c];if(!o)return n.apply(e,[t].concat(u));var f=t&&t.whyDidYouRender&&t.whyDidYouRender.customName||C(t),s=function(e,t,r,n,o){if(e.has(t))return e.get(t);var a=Hn(0,t,r,n,o);return e.set(t,a),a}(a,t,f,e,r);return n.apply(e,[s].concat(u))},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,o),e.__REVERT_WHY_DID_YOU_RENDER__=function(){e.createElement=n,e.createFactory=o,a=null,delete e.__REVERT_WHY_DID_YOU_RENDER__},e}}); | ||
!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){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(r){t(e,r,n[r])})}return e}function n(e){return(n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function i(e,t,r){return(i="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var o=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=n(e)););return e}(e,t);if(o){var a=Object.getOwnPropertyDescriptor(o,t);return a.get?a.get.call(r):a.value}})(e,t,r||e)}function u(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 c=function(e){return e};var f=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)},s=Math.max;var l=function(e,t,r){return t=s(void 0===t?e.length-1:t,0),function(){for(var n=arguments,o=-1,a=s(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),f(e,this,u)}};var p=function(e){return function(){return e}},v="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function h(e,t){return e(t={exports:{}},t.exports),t.exports}var y="object"==typeof v&&v&&v.Object===Object&&v,d="object"==typeof self&&self&&self.Object===Object&&self,b=y||d||Function("return this")(),g=b.Symbol,_=Object.prototype,j=_.hasOwnProperty,m=_.toString,O=g?g.toStringTag:void 0;var w=function(e){var t=j.call(e,O),r=e[O];try{e[O]=void 0;var n=!0}catch(e){}var o=m.call(e);return n&&(t?e[O]=r:delete e[O]),o},S=Object.prototype.toString;var E=function(e){return S.call(e)},P="[object Null]",x="[object Undefined]",D=g?g.toStringTag:void 0;var A=function(e){return null==e?void 0===e?x:P:D&&D in Object(e)?w(e):E(e)};var R=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},z="[object AsyncFunction]",T="[object Function]",k="[object GeneratorFunction]",N="[object Proxy]";var $,C=function(e){if(!R(e))return!1;var t=A(e);return t==T||t==k||t==z||t==N},F=b["__core-js_shared__"],L=($=/[^.]+$/.exec(F&&F.keys&&F.keys.IE_PROTO||""))?"Symbol(src)_1."+$:"";var V=function(e){return!!L&&L in e},M=Function.prototype.toString;var Y=function(e){if(null!=e){try{return M.call(e)}catch(e){}try{return e+""}catch(e){}}return""},q=/^\[object .+?Constructor\]$/,B=Function.prototype,I=Object.prototype,U=B.toString,G=I.hasOwnProperty,W=RegExp("^"+U.call(G).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var H=function(e){return!(!R(e)||V(e))&&(C(e)?W:q).test(Y(e))};var J=function(e,t){return null==e?void 0:e[t]};var K=function(e,t){var r=J(e,t);return H(r)?r:void 0},Q=function(){try{var e=K(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),X=Q?function(e,t){return Q(e,"toString",{configurable:!0,enumerable:!1,value:p(t),writable:!0})}:c,Z=800,ee=16,te=Date.now;var re=function(e){var t=0,r=0;return function(){var n=te(),o=ee-(n-r);if(r=n,o>0){if(++t>=Z)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(X);var ne=function(e,t){return re(l(e,t,c),e+"")};var oe=function(e,t){return e===t||e!=e&&t!=t},ae=9007199254740991;var ie=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=ae};var ue=function(e){return null!=e&&ie(e.length)&&!C(e)},ce=9007199254740991,fe=/^(?:0|[1-9]\d*)$/;var se=function(e,t){var r=typeof e;return!!(t=null==t?ce:t)&&("number"==r||"symbol"!=r&&fe.test(e))&&e>-1&&e%1==0&&e<t};var le=function(e,t,r){if(!R(r))return!1;var n=typeof t;return!!("number"==n?ue(r)&&se(t,r.length):"string"==n&&t in r)&&oe(r[t],e)};var pe=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n};var ve=function(e){return null!=e&&"object"==typeof e},he="[object Arguments]";var ye=function(e){return ve(e)&&A(e)==he},de=Object.prototype,be=de.hasOwnProperty,ge=de.propertyIsEnumerable,_e=ye(function(){return arguments}())?ye:function(e){return ve(e)&&be.call(e,"callee")&&!ge.call(e,"callee")},je=Array.isArray;var me=function(){return!1},Oe=h(function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,o=n&&n.exports===r?b.Buffer:void 0,a=(o?o.isBuffer:void 0)||me;e.exports=a}),we={};we["[object Float32Array]"]=we["[object Float64Array]"]=we["[object Int8Array]"]=we["[object Int16Array]"]=we["[object Int32Array]"]=we["[object Uint8Array]"]=we["[object Uint8ClampedArray]"]=we["[object Uint16Array]"]=we["[object Uint32Array]"]=!0,we["[object Arguments]"]=we["[object Array]"]=we["[object ArrayBuffer]"]=we["[object Boolean]"]=we["[object DataView]"]=we["[object Date]"]=we["[object Error]"]=we["[object Function]"]=we["[object Map]"]=we["[object Number]"]=we["[object Object]"]=we["[object RegExp]"]=we["[object Set]"]=we["[object String]"]=we["[object WeakMap]"]=!1;var Se=function(e){return ve(e)&&ie(e.length)&&!!we[A(e)]};var Ee=function(e){return function(t){return e(t)}},Pe=h(function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,o=n&&n.exports===r&&y.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}),xe=Pe&&Pe.isTypedArray,De=xe?Ee(xe):Se,Ae=Object.prototype.hasOwnProperty;var Re=function(e,t){var r=je(e),n=!r&&_e(e),o=!r&&!n&&Oe(e),a=!r&&!n&&!o&&De(e),i=r||n||o||a,u=i?pe(e.length,String):[],c=u.length;for(var f in e)!t&&!Ae.call(e,f)||i&&("length"==f||o&&("offset"==f||"parent"==f)||a&&("buffer"==f||"byteLength"==f||"byteOffset"==f)||se(f,c))||u.push(f);return u},ze=Object.prototype;var Te=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ze)};var ke=function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t},Ne=Object.prototype.hasOwnProperty;var $e=function(e){if(!R(e))return ke(e);var t=Te(e),r=[];for(var n in e)("constructor"!=n||!t&&Ne.call(e,n))&&r.push(n);return r};var Ce,Fe=function(e){return ue(e)?Re(e,!0):$e(e)},Le=Object.prototype,Ve=Le.hasOwnProperty,Me=ne(function(e,t){e=Object(e);var r=-1,n=t.length,o=n>2?t[2]:void 0;for(o&&le(t[0],t[1],o)&&(n=1);++r<n;)for(var a=t[r],i=Fe(a),u=-1,c=i.length;++u<c;){var f=i[u],s=e[f];(void 0===s||oe(s,Le[f])&&!Ve.call(e,f))&&(e[f]=a[f])}return e}),Ye={different:"different",deepEquals:"deepEquals",date:"date",regex:"regex",reactElement:"reactElement",function:"function"},qe="http://bit.ly/wdyr02",Be=(t(Ce={},Ye.different,"different objects."),t(Ce,Ye.deepEquals,"different objects that are equal by value."),t(Ce,Ye.date,"different date objects with the same value."),t(Ce,Ye.regex,"different regular expressions with the same value."),t(Ce,Ye.reactElement,"different React elements with the same displayName."),t(Ce,Ye.function,"different functions with the same name."),Ce),Ie=!1;function Ue(e,r,n,o,a,i,u){a&&a.length>0?(u.consoleLog(t({},r,e),"".concat(n," of ").concat(o," changes:")),a.forEach(function(e){var r=e.pathString,n=e.diffType,a=e.prevValue,i=e.nextValue;u.consoleGroup("%c".concat(o,".%c").concat(r,"%c"),"color:blue;","color:red;","color:black;"),u.consoleLog("".concat(Be[n]," (more info at ").concat(qe,")")),u.consoleLog(t({},"prev ".concat(r),a),"!==",t({},"next ".concat(r),i)),u.consoleGroupEnd()})):a&&(u.consoleLog(t({},r,e),"".concat(n," the ").concat(o," object itself changed but it's values are all equal."),"props"===o?"This could of been avoided by making the component pure, or by preventing it's father from re-rendering.":"This usually means this component called setState when no changes in it's state actually occurred.","more info at ".concat(qe)),u.consoleLog("prev ".concat(o,":"),i.prev," !== ",i.next,":next ".concat(o)))}function Ge(e){var r=e.Component,n=e.displayName,o=e.prevProps,a=e.prevState,i=e.nextProps,u=e.nextState,c=e.reason,f=e.options;if(function(e,t,r){return!(Ie||!r.logOnDifferentValues&&(!t.whyDidYouRender||!t.whyDidYouRender.logOnDifferentValues)&&(e.propsDifferences&&e.propsDifferences.some(function(e){return e.diffType===Ye.different})||e.stateDifferences&&e.stateDifferences.some(function(e){return e.diffType===Ye.different})))}(c,r,f)){f.consoleGroup("%c".concat(n),"color: #058;");var s="Re-rendered because";c.propsDifferences&&(Ue(r,n,s,"props",c.propsDifferences,{prev:o,next:i},f),s="And because"),c.stateDifferences&&Ue(r,n,s,"state",c.stateDifferences,{prev:a,next:u},f),c.propsDifferences||c.stateDifferences||f.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(qe)),f.consoleGroupEnd()}}var We=function(){};function He(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=console.group,o=console.groupEnd;return t.collapseGroups?n=console.groupCollapsed:t.onlyLogs&&(n=console.log,o=We),r({include:null,exclude:null,notifier:t.notifier||((e=t.hasOwnProperty("hotReloadBufferMs")?t.hotReloadBufferMs:500)&&module&&module.hot&&module.hot.addStatusHandler&&module.hot.addStatusHandler(function(t){"idle"===t&&(Ie=!0,setTimeout(function(){Ie=!1},e))}),Ge),onlyLogs:!1,consoleLog:console.log,consoleGroup:n,consoleGroupEnd:o,logOnDifferentValues:!1},t)}var Je="[object String]";var Ke=function(e){return"string"==typeof e||!je(e)&&ve(e)&&A(e)==Je};function Qe(e){return e.displayName||e.name||e.type&&Qe(e.type)||(Ke(e)?e:void 0)}var Xe=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 Ze=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 et=function(e,t){return function(r){return e(t(r))}},tt=et(Object.keys,Object),rt=Object.prototype.hasOwnProperty;var nt=function(e){if(!Te(e))return tt(e);var t=[];for(var r in Object(e))rt.call(e,r)&&"constructor"!=r&&t.push(r);return t};var ot=function(e){return ue(e)?Re(e):nt(e)};var at=function(e,t){return function(r,n){if(null==r)return r;if(!ue(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}}(function(e,t){return e&&Ze(e,t,ot)});var it=function(){this.__data__=[],this.size=0};var ut=function(e,t){for(var r=e.length;r--;)if(oe(e[r][0],t))return r;return-1},ct=Array.prototype.splice;var ft=function(e){var t=this.__data__,r=ut(t,e);return!(r<0||(r==t.length-1?t.pop():ct.call(t,r,1),--this.size,0))};var st=function(e){var t=this.__data__,r=ut(t,e);return r<0?void 0:t[r][1]};var lt=function(e){return ut(this.__data__,e)>-1};var pt=function(e,t){var r=this.__data__,n=ut(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};function vt(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])}}vt.prototype.clear=it,vt.prototype.delete=ft,vt.prototype.get=st,vt.prototype.has=lt,vt.prototype.set=pt;var ht=vt;var yt=function(){this.__data__=new ht,this.size=0};var dt=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r};var bt=function(e){return this.__data__.get(e)};var gt=function(e){return this.__data__.has(e)},_t=K(b,"Map"),jt=K(Object,"create");var mt=function(){this.__data__=jt?jt(null):{},this.size=0};var Ot=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},wt="__lodash_hash_undefined__",St=Object.prototype.hasOwnProperty;var Et=function(e){var t=this.__data__;if(jt){var r=t[e];return r===wt?void 0:r}return St.call(t,e)?t[e]:void 0},Pt=Object.prototype.hasOwnProperty;var xt=function(e){var t=this.__data__;return jt?void 0!==t[e]:Pt.call(t,e)},Dt="__lodash_hash_undefined__";var At=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=jt&&void 0===t?Dt:t,this};function Rt(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])}}Rt.prototype.clear=mt,Rt.prototype.delete=Ot,Rt.prototype.get=Et,Rt.prototype.has=xt,Rt.prototype.set=At;var zt=Rt;var Tt=function(){this.size=0,this.__data__={hash:new zt,map:new(_t||ht),string:new zt}};var kt=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Nt=function(e,t){var r=e.__data__;return kt(t)?r["string"==typeof t?"string":"hash"]:r.map};var $t=function(e){var t=Nt(this,e).delete(e);return this.size-=t?1:0,t};var Ct=function(e){return Nt(this,e).get(e)};var Ft=function(e){return Nt(this,e).has(e)};var Lt=function(e,t){var r=Nt(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};function Vt(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])}}Vt.prototype.clear=Tt,Vt.prototype.delete=$t,Vt.prototype.get=Ct,Vt.prototype.has=Ft,Vt.prototype.set=Lt;var Mt=Vt,Yt=200;var qt=function(e,t){var r=this.__data__;if(r instanceof ht){var n=r.__data__;if(!_t||n.length<Yt-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Mt(n)}return r.set(e,t),this.size=r.size,this};function Bt(e){var t=this.__data__=new ht(e);this.size=t.size}Bt.prototype.clear=yt,Bt.prototype.delete=dt,Bt.prototype.get=bt,Bt.prototype.has=gt,Bt.prototype.set=qt;var It=Bt,Ut="__lodash_hash_undefined__";var Gt=function(e){return this.__data__.set(e,Ut),this};var Wt=function(e){return this.__data__.has(e)};function Ht(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new Mt;++t<r;)this.add(e[t])}Ht.prototype.add=Ht.prototype.push=Gt,Ht.prototype.has=Wt;var Jt=Ht;var Kt=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 Qt=function(e,t){return e.has(t)},Xt=1,Zt=2;var er=function(e,t,r,n,o,a){var i=r&Xt,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&Zt?new Jt:void 0;for(a.set(e,t),a.set(t,e);++s<u;){var v=e[s],h=t[s];if(n)var y=i?n(h,v,s,t,e,a):n(v,h,s,e,t,a);if(void 0!==y){if(y)continue;l=!1;break}if(p){if(!Kt(t,function(e,t){if(!Qt(p,t)&&(v===e||o(v,e,r,n,a)))return p.push(t)})){l=!1;break}}else if(v!==h&&!o(v,h,r,n,a)){l=!1;break}}return a.delete(e),a.delete(t),l},tr=b.Uint8Array;var rr=function(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r};var nr=function(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r},or=1,ar=2,ir="[object Boolean]",ur="[object Date]",cr="[object Error]",fr="[object Map]",sr="[object Number]",lr="[object RegExp]",pr="[object Set]",vr="[object String]",hr="[object Symbol]",yr="[object ArrayBuffer]",dr="[object DataView]",br=g?g.prototype:void 0,gr=br?br.valueOf:void 0;var _r=function(e,t,r,n,o,a,i){switch(r){case dr:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case yr:return!(e.byteLength!=t.byteLength||!a(new tr(e),new tr(t)));case ir:case ur:case sr:return oe(+e,+t);case cr:return e.name==t.name&&e.message==t.message;case lr:case vr:return e==t+"";case fr:var u=rr;case pr:var c=n∨if(u||(u=nr),e.size!=t.size&&!c)return!1;var f=i.get(e);if(f)return f==t;n|=ar,i.set(e,t);var s=er(u(e),u(t),n,o,a,i);return i.delete(e),s;case hr:if(gr)return gr.call(e)==gr.call(t)}return!1};var jr=function(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e};var mr=function(e,t,r){var n=t(e);return je(e)?n:jr(n,r(e))};var Or=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 wr=function(){return[]},Sr=Object.prototype.propertyIsEnumerable,Er=Object.getOwnPropertySymbols,Pr=Er?function(e){return null==e?[]:(e=Object(e),Or(Er(e),function(t){return Sr.call(e,t)}))}:wr;var xr=function(e){return mr(e,ot,Pr)},Dr=1,Ar=Object.prototype.hasOwnProperty;var Rr=function(e,t,r,n,o,a){var i=r&Dr,u=xr(e),c=u.length;if(c!=xr(t).length&&!i)return!1;for(var f=c;f--;){var s=u[f];if(!(i?s in t:Ar.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 h=e[s=u[f]],y=t[s];if(n)var d=i?n(y,h,s,t,e,a):n(h,y,s,e,t,a);if(!(void 0===d?h===y||o(h,y,r,n,a):d)){p=!1;break}v||(v="constructor"==s)}if(p&&!v){var b=e.constructor,g=t.constructor;b!=g&&"constructor"in e&&"constructor"in t&&!("function"==typeof b&&b instanceof b&&"function"==typeof g&&g instanceof g)&&(p=!1)}return a.delete(e),a.delete(t),p},zr=K(b,"DataView"),Tr=K(b,"Promise"),kr=K(b,"Set"),Nr=K(b,"WeakMap"),$r=Y(zr),Cr=Y(_t),Fr=Y(Tr),Lr=Y(kr),Vr=Y(Nr),Mr=A;(zr&&"[object DataView]"!=Mr(new zr(new ArrayBuffer(1)))||_t&&"[object Map]"!=Mr(new _t)||Tr&&"[object Promise]"!=Mr(Tr.resolve())||kr&&"[object Set]"!=Mr(new kr)||Nr&&"[object WeakMap]"!=Mr(new Nr))&&(Mr=function(e){var t=A(e),r="[object Object]"==t?e.constructor:void 0,n=r?Y(r):"";if(n)switch(n){case $r:return"[object DataView]";case Cr:return"[object Map]";case Fr:return"[object Promise]";case Lr:return"[object Set]";case Vr:return"[object WeakMap]"}return t});var Yr=Mr,qr=1,Br="[object Arguments]",Ir="[object Array]",Ur="[object Object]",Gr=Object.prototype.hasOwnProperty;var Wr=function(e,t,r,n,o,a){var i=je(e),u=je(t),c=i?Ir:Yr(e),f=u?Ir:Yr(t),s=(c=c==Br?Ur:c)==Ur,l=(f=f==Br?Ur:f)==Ur,p=c==f;if(p&&Oe(e)){if(!Oe(t))return!1;i=!0,s=!1}if(p&&!s)return a||(a=new It),i||De(e)?er(e,t,r,n,o,a):_r(e,t,c,r,n,o,a);if(!(r&qr)){var v=s&&Gr.call(e,"__wrapped__"),h=l&&Gr.call(t,"__wrapped__");if(v||h){var y=v?e.value():e,d=h?t.value():t;return a||(a=new It),o(y,d,r,n,a)}}return!!p&&(a||(a=new It),Rr(e,t,r,n,o,a))};var Hr=function e(t,r,n,o,a){return t===r||(null==t||null==r||!ve(t)&&!ve(r)?t!=t&&r!=r:Wr(t,r,n,o,e,a))},Jr=1,Kr=2;var Qr=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 It;if(n)var p=n(f,s,c,e,t,l);if(!(void 0===p?Hr(s,f,Jr|Kr,n,l):p))return!1}}return!0};var Xr=function(e){return e==e&&!R(e)};var Zr=function(e){for(var t=ot(e),r=t.length;r--;){var n=t[r],o=e[n];t[r]=[n,o,Xr(o)]}return t};var en=function(e,t){return function(r){return null!=r&&r[e]===t&&(void 0!==t||e in Object(r))}};var tn=function(e){var t=Zr(e);return 1==t.length&&t[0][2]?en(t[0][0],t[0][1]):function(r){return r===e||Qr(r,e,t)}},rn="[object Symbol]";var nn=function(e){return"symbol"==typeof e||ve(e)&&A(e)==rn},on=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,an=/^\w*$/;var un=function(e,t){if(je(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!nn(e))||an.test(e)||!on.test(e)||null!=t&&e in Object(t)},cn="Expected a function";function fn(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(cn);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(fn.Cache||Mt),r}fn.Cache=Mt;var sn=fn,ln=500;var pn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vn=/\\(\\)?/g,hn=function(e){var t=sn(e,function(e){return r.size===ln&&r.clear(),e}),r=t.cache;return t}(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(pn,function(e,r,n,o){t.push(n?o.replace(vn,"$1"):r||e)}),t});var yn=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},dn=1/0,bn=g?g.prototype:void 0,gn=bn?bn.toString:void 0;var _n=function e(t){if("string"==typeof t)return t;if(je(t))return yn(t,e)+"";if(nn(t))return gn?gn.call(t):"";var r=t+"";return"0"==r&&1/t==-dn?"-0":r};var jn=function(e){return null==e?"":_n(e)};var mn=function(e,t){return je(e)?e:un(e,t)?[e]:hn(jn(e))},On=1/0;var wn=function(e){if("string"==typeof e||nn(e))return e;var t=e+"";return"0"==t&&1/e==-On?"-0":t};var Sn=function(e,t){for(var r=0,n=(t=mn(t,e)).length;null!=e&&r<n;)e=e[wn(t[r++])];return r&&r==n?e:void 0};var En=function(e,t,r){var n=null==e?void 0:Sn(e,t);return void 0===n?r:n};var Pn=function(e,t){return null!=e&&t in Object(e)};var xn=function(e,t,r){for(var n=-1,o=(t=mn(t,e)).length,a=!1;++n<o;){var i=wn(t[n]);if(!(a=null!=e&&r(e,i)))break;e=e[i]}return a||++n!=o?a:!!(o=null==e?0:e.length)&&ie(o)&&se(i,o)&&(je(e)||_e(e))};var Dn=function(e,t){return null!=e&&xn(e,t,Pn)},An=1,Rn=2;var zn=function(e,t){return un(e)&&Xr(t)?en(wn(e),t):function(r){var n=En(r,e);return void 0===n&&n===t?Dn(r,e):Hr(t,n,An|Rn)}};var Tn=function(e){return function(t){return null==t?void 0:t[e]}};var kn=function(e){return function(t){return Sn(t,e)}};var Nn=function(e){return un(e)?Tn(wn(e)):kn(e)};var $n=function(e){return"function"==typeof e?e:null==e?c:"object"==typeof e?je(e)?zn(e[0],e[1]):tn(e):Nn(e)};var Cn=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 Fn=function(e,t,r){var n=je(e)?Xe:Cn,o=arguments.length<3;return n(e,$n(t,4),r,o,at)},Ln=Object.prototype.hasOwnProperty;var Vn=function(e,t){return null!=e&&Ln.call(e,t)};var Mn=function(e,t){return null!=e&&xn(e,t,Vn)},Yn="[object RegExp]";var qn=function(e){return ve(e)&&A(e)==Yn},Bn=Pe&&Pe.isRegExp,In=Bn?Ee(Bn):qn,Un="[object Date]";var Gn=function(e){return ve(e)&&A(e)==Un},Wn=Pe&&Pe.isDate,Hn=Wn?Ee(Wn):Gn,Jn=et(Object.getPrototypeOf,Object),Kn="[object Object]",Qn=Function.prototype,Xn=Object.prototype,Zn=Qn.toString,eo=Xn.hasOwnProperty,to=Zn.call(Object);var ro=function(e){if(!ve(e)||A(e)!=Kn)return!1;var t=Jn(e);if(null===t)return!0;var r=eo.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&Zn.call(r)==to},no="undefined"!=typeof Element,oo="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103,ao=function(e){return e.$$typeof===oo};function io(e,t,r,n,o){return r.push({diffType:o,pathString:n,prevValue:e,nextValue:t}),o!==Ye.different}function uo(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 io(t,r,n,o,Ye.different);if(je(t)&&je(r)){var a=t.length;if(a!==r.length)return io(t,r,n,o,Ye.different);for(var i=!0,u=a;0!=u--;)e(t[u],r[u],n,"".concat(o,"[").concat(u,"]"))||(i=!1);return io(t,r,n,o,i?Ye.deepEquals:Ye.different)}if(Hn(t)&&Hn(r))return t.getTime()===r.getTime()?io(t,r,n,o,Ye.date):io(t,r,n,o,Ye.different);if(In(t)&&In(r))return t.toString()===r.toString()?io(t,r,n,o,Ye.regex):io(t,r,n,o,Ye.different);if(no&&t instanceof Element&&r instanceof Element)return io(t,r,n,o,Ye.different);if(ao(t)&&ao(r))return t.type===r.type?io(t,r,n,o,Ye.reactElement):io(t,r,n,o,Ye.different);if(C(t)&&C(r))return t.name===r.name?io(t,r,n,o,Ye.function):io(t,r,n,o,Ye.different);if(ro(t)&&ro(r)){var c=ot(t),f=c.length;if(f!==ot(r).length)return io(t,r,n,o,Ye.different);for(var s=f;0!=s--;)if(!Mn(r,c[s]))return io(t,r,n,o,Ye.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 io(t,r,n,o,l?Ye.deepEquals:Ye.different)}return io(t,r,n,o,Ye.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 co={};function fo(e,t){if(e===t)return!1;var n=e||co,o=t||co,a=ot(r({},n,o));return Fn(a,function(e,t){var r=uo(n[t],o[t],t);return r&&(e=[].concat(u(e||[]),u(r))),e},[])}function so(e,t,r,n){return{propsDifferences:fo(e,r),stateDifferences:fo(t,n)}}function lo(e){var t=e.Component,r=e.displayName,n=e.prevProps,o=e.prevState,a=e.nextProps,i=e.nextState;return{Component:t,displayName:r,prevProps:n,prevState:o,nextProps:a,nextState:i,options:e.options,reason:so(n,o,a,i)}}var po="function"==typeof Symbol&&Symbol.for?Symbol.for("react.memo"):60115;function vo(t,r,u,c){var f=function(u){function f(e,r){var o,i,u;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,f),i=this,u=n(f).call(this,e,r),(o=!u||"object"!=typeof u&&"function"!=typeof u?a(i):u).render&&!t.prototype.render){var c=o.render;o.render=function(){return f.prototype.render.apply(a(o)),c()}}return o}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&&o(e,t)}(f,t),s=f,(l=[{key:"render",value:function(){return this._prevProps&&c.notifier(lo({Component:t,displayName:r,prevProps:this._prevProps,prevState:this._prevState,nextProps:this.props,nextState:this.state,options:c})),this._prevProps=this.props,this._prevState=this.state,i(n(f.prototype),"render",this)&&i(n(f.prototype),"render",this).call(this)}}])&&e(s.prototype,l),p&&e(s,p),f}();return f.displayName=r,Me(f,t),f}function ho(e,t,r,n,o){return t.$$typeof===po?function(e,t,r,n){var o=r.memo(function(o){var a=r.useRef(),i=a.current;return a.current=o,i&&n.notifier(lo({Component:e,displayName:t,prevProps:i,nextProps:o,options:n})),e.type(o)});return o.displayName=t,Me(o,o),o}(t,r,n,o):t.prototype&&t.prototype.isReactComponent?vo(t,r,0,o):function(e,t,r,n){function o(o){var a=r.useRef(),i=a.current;return a.current=o,i&&n.notifier(lo({Component:e,displayName:t,prevProps:i,nextProps:o,options:n})),e(o)}return o.displayName=t,Me(o,e),o}(t,r,n,o)}return function(e,t){var r=He(t),n=e.createElement,o=e.createFactory,a=new WeakMap;return e.createElement=function(t){for(var o=("function"==typeof t||t.$$typeof===po)&&function(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))}(t,Qe(t),r),i=arguments.length,u=new Array(i>1?i-1:0),c=1;c<i;c++)u[c-1]=arguments[c];if(!o)return n.apply(e,[t].concat(u));var f=t&&t.whyDidYouRender&&t.whyDidYouRender.customName||Qe(t),s=function(e,t,r,n,o){if(e.has(t))return e.get(t);var a=ho(0,t,r,n,o);return e.set(t,a),a}(a,t,f,e,r);return n.apply(e,[s].concat(u))},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,o),e.__REVERT_WHY_DID_YOU_RENDER__=function(){e.createElement=n,e.createFactory=o,a=null,delete e.__REVERT_WHY_DID_YOU_RENDER__},e}}); | ||
//# sourceMappingURL=whyDidYouRender.min.js.map |
{ | ||
"name": "@welldone-software/why-did-you-render", | ||
"version": "2.5.2", | ||
"version": "2.6.0", | ||
"description": "Monkey patches React to notify you about avoidable re-renders.", | ||
@@ -37,3 +37,3 @@ "main": "dist/cjs/whyDidYouRender.min.js", | ||
"dependencies": { | ||
"lodash": "^4.0.0" | ||
"lodash": "^4.17.11" | ||
}, | ||
@@ -45,5 +45,5 @@ "peerDependencies": { | ||
"@babel/cli": "^7.2.3", | ||
"@babel/core": "^7.2.2", | ||
"@babel/plugin-proposal-class-properties": "^7.3.0", | ||
"@babel/preset-env": "^7.3.1", | ||
"@babel/core": "^7.3.4", | ||
"@babel/plugin-proposal-class-properties": "^7.3.4", | ||
"@babel/preset-env": "^7.3.4", | ||
"@babel/preset-react": "^7.0.0", | ||
@@ -54,3 +54,3 @@ "acorn-walk": "^6.1.1", | ||
"babel-eslint": "^10.0.1", | ||
"babel-jest": "^24.1.0", | ||
"babel-jest": "^24.5.0", | ||
"babel-plugin-lodash": "^3.3.4", | ||
@@ -60,24 +60,24 @@ "concurrently": "^4.1.0", | ||
"cross-env": "^5.2.0", | ||
"eslint": "^5.13.0", | ||
"eslint-plugin-jest": "^22.2.2", | ||
"eslint": "^5.15.2", | ||
"eslint-plugin-jest": "^22.4.1", | ||
"eslint-plugin-react": "^7.12.4", | ||
"eslint-watch": "^4.0.2", | ||
"eslint-watch": "^5.0.1", | ||
"express": "^4.16.4", | ||
"express-history-api-fallback": "^2.2.1", | ||
"husky": "^1.3.1", | ||
"jest": "^24.1.0", | ||
"jest-cli": "^24.1.0", | ||
"jest": "^24.5.0", | ||
"jest-cli": "^24.5.0", | ||
"magic-string": "^0.25.2", | ||
"nollup": "^0.5.0", | ||
"react": "^16.8.1", | ||
"react-dom": "^16.8.1", | ||
"react-hot-loader": "^4.6.5", | ||
"react-test-renderer": "^16.8.1", | ||
"nollup": "^0.5.2", | ||
"react": "^16.8.4", | ||
"react-dom": "^16.8.4", | ||
"react-hot-loader": "^4.8.0", | ||
"react-test-renderer": "^16.8.4", | ||
"rimraf": "^2.6.3", | ||
"rollup": "^1.1.2", | ||
"rollup": "^1.6.0", | ||
"rollup-plugin-babel": "^4.3.2", | ||
"rollup-plugin-commonjs": "^9.2.0", | ||
"rollup-plugin-commonjs": "^9.2.1", | ||
"rollup-plugin-commonjs-alternate": "^0.0.5", | ||
"rollup-plugin-license": "^0.8.1", | ||
"rollup-plugin-node-resolve": "^4.0.0", | ||
"rollup-plugin-node-resolve": "^4.0.1", | ||
"rollup-plugin-replace": "^2.1.0", | ||
@@ -84,0 +84,0 @@ "rollup-plugin-terser": "^4.0.4" |
import {isString} from 'lodash' | ||
export default function getDisplayName(type){ | ||
return type.displayName || type.name || (isString(type) ? type : undefined) | ||
return ( | ||
type.displayName || | ||
type.name || | ||
(type.type && getDisplayName(type.type)) || | ||
(isString(type) ? type : undefined) | ||
) | ||
} |
@@ -13,2 +13,8 @@ /* eslint-disable no-console */ | ||
const ReactMemoTestComponent = React.memo(() => ( | ||
<div>hi!</div> | ||
)) | ||
ReactMemoTestComponent.whyDidYouRender = true | ||
ReactMemoTestComponent.dispalyName = 'ReactMemoTestComponent' | ||
class TestComponent extends React.Component{ | ||
@@ -214,3 +220,3 @@ static whyDidYouRender = true | ||
it('With implemented "componentDidUpdate()" with a snapshot', () => { | ||
it('With implemented "componentDidUpdate()" with a snapshot - not tracked', () => { | ||
let resolve = false | ||
@@ -240,2 +246,28 @@ class OwnTestComponent extends React.Component{ | ||
it('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 testRenderer = TestRenderer.create( | ||
<OwnTestComponent a={1}/> | ||
) | ||
testRenderer.update( | ||
<OwnTestComponent a={1}/> | ||
) | ||
expect(resolve).toBe(true) | ||
expect(updateInfos).toHaveLength(1) | ||
}) | ||
test('Component created with "createReactClass"', () => { | ||
@@ -416,2 +448,34 @@ const CreateReactClassComponent = createReactClass({ | ||
}) | ||
test('Component memoized with React.memo', () => { | ||
const testRenderer = TestRenderer.create( | ||
<ReactMemoTestComponent a={1}/> | ||
) | ||
testRenderer.update( | ||
<ReactMemoTestComponent a={2}/> | ||
) | ||
expect(updateInfos[0].reason).toEqual({ | ||
propsDifferences: [{ | ||
pathString: 'a', | ||
diffType: diffTypes.different, | ||
prevValue: 1, | ||
nextValue: 2 | ||
}], | ||
stateDifferences: false | ||
}) | ||
expect(updateInfos).toHaveLength(1) | ||
}) | ||
test('Component memoized with React.memo - no change', () => { | ||
const testRenderer = TestRenderer.create( | ||
<ReactMemoTestComponent a={1}/> | ||
) | ||
testRenderer.update( | ||
<ReactMemoTestComponent a={1}/> | ||
) | ||
expect(updateInfos).toHaveLength(0) | ||
}) | ||
}) |
@@ -0,1 +1,3 @@ | ||
import {defaults} from 'lodash' | ||
import normalizeOptions from './normalizeOptions' | ||
@@ -6,2 +8,5 @@ import getDisplayName from './getDisplayName' | ||
const hasSymbol = typeof Symbol === 'function' && Symbol.for | ||
const REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3 | ||
function patchClassComponent(ClassComponent, displayName, React, options){ | ||
@@ -40,3 +45,4 @@ class WDYRPatchedClassComponent extends ClassComponent{ | ||
Object.assign(WDYRPatchedClassComponent, ClassComponent, {displayName}) | ||
WDYRPatchedClassComponent.displayName = displayName | ||
defaults(WDYRPatchedClassComponent, ClassComponent) | ||
@@ -66,3 +72,4 @@ return WDYRPatchedClassComponent | ||
Object.assign(WDYRFunctionalComponent, FunctionalComponent, {displayName}) | ||
WDYRFunctionalComponent.displayName = displayName | ||
defaults(WDYRFunctionalComponent, FunctionalComponent) | ||
@@ -72,3 +79,33 @@ return WDYRFunctionalComponent | ||
function patchMemoComponent(MemoComponent, displayName, React, options){ | ||
const WDYRFunctionalComponent = React.memo(nextProps => { | ||
const prevCountRef = React.useRef() | ||
const prevProps = prevCountRef.current | ||
prevCountRef.current = nextProps | ||
if(prevProps){ | ||
options.notifier(getUpdateInfo({ | ||
Component: MemoComponent, | ||
displayName, | ||
prevProps, | ||
nextProps, | ||
options | ||
})) | ||
} | ||
return MemoComponent.type(nextProps) | ||
}) | ||
WDYRFunctionalComponent.displayName = displayName | ||
defaults(WDYRFunctionalComponent, WDYRFunctionalComponent) | ||
return WDYRFunctionalComponent | ||
} | ||
function createPatchedComponent(componentsMap, Component, displayName, React, options){ | ||
if(Component.$$typeof === REACT_MEMO_TYPE){ | ||
return patchMemoComponent(Component, displayName, React, options) | ||
} | ||
if(Component.prototype && Component.prototype.isReactComponent){ | ||
@@ -102,3 +139,6 @@ return patchClassComponent(Component, displayName, React, options) | ||
const isShouldTrack = ( | ||
typeof componentNameOrComponent === 'function' && | ||
( | ||
typeof componentNameOrComponent === 'function' || | ||
componentNameOrComponent.$$typeof === REACT_MEMO_TYPE | ||
) && | ||
shouldTrack(componentNameOrComponent, getDisplayName(componentNameOrComponent), options) | ||
@@ -105,0 +145,0 @@ ) |
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 too big to display
Sorry, the diff of this file is not supported yet
863942
11752
Updatedlodash@^4.17.11