react-infinity-menu
Advanced tools
Comparing version 2.3.0 to 2.4.0
@@ -79,17 +79,13 @@ "use strict"; | ||
/* | ||
* @function shouldComponentUpdate | ||
* @description check for edge cases with filtering that can cause loops | ||
* | ||
* @param {object} nextProps - next props to be fed into this component | ||
* @param {object} nextState - next state based on user interactions | ||
* | ||
* @returns {boolean} true if something changed based on user interaction | ||
*/ | ||
* @function shouldComponentUpdate | ||
* @returns {boolean} return based on user pass in shouldComponentUpdate or return true | ||
*/ | ||
}, { | ||
key: "shouldComponentUpdate", | ||
value: function shouldComponentUpdate(nextProps, nextState) { | ||
if (this.state.search.isSearching && nextState.search.searchInput && this.state.search.searchInput === nextState.search.searchInput) { | ||
return false; | ||
if (nextProps.shouldComponentUpdate) { | ||
return nextProps.shouldComponentUpdate(this.props, this.state, nextProps, nextState); | ||
} else { | ||
return true; | ||
} | ||
return true; | ||
} | ||
@@ -411,3 +407,4 @@ | ||
onLeafMouseDown: _react2["default"].PropTypes.func, | ||
onLeafMouseUp: _react2["default"].PropTypes.func | ||
onLeafMouseUp: _react2["default"].PropTypes.func, | ||
shouldComponentUpdate: _react2["default"].PropTypes.func | ||
}; | ||
@@ -414,0 +411,0 @@ |
{ | ||
"name": "react-infinity-menu", | ||
"version": "2.3.0", | ||
"version": "2.4.0", | ||
"description": "An unlimited deep side menu", | ||
@@ -5,0 +5,0 @@ "main": "./dist/infinity-menu.js", |
@@ -225,4 +225,7 @@ # react-infinity-menu | ||
#### shouldComponentUpdate(function) [currProps, currState, nextProps, nextState] | ||
A function that will be called inside shouldComponentUpdate. It's a good place to optimize update. | ||
# Styles | ||
@@ -229,0 +232,0 @@ There is a default style sheet you can use if you so desire. |
@@ -42,17 +42,12 @@ import React from "react"; | ||
/* | ||
* @function shouldComponentUpdate | ||
* @description check for edge cases with filtering that can cause loops | ||
* | ||
* @param {object} nextProps - next props to be fed into this component | ||
* @param {object} nextState - next state based on user interactions | ||
* | ||
* @returns {boolean} true if something changed based on user interaction | ||
*/ | ||
* @function shouldComponentUpdate | ||
* @returns {boolean} return based on user pass in shouldComponentUpdate or return true | ||
*/ | ||
shouldComponentUpdate(nextProps, nextState) { | ||
if (this.state.search.isSearching | ||
&& nextState.search.searchInput | ||
&& this.state.search.searchInput === nextState.search.searchInput) { | ||
return false; | ||
if (nextProps.shouldComponentUpdate) { | ||
return nextProps.shouldComponentUpdate(this.props, this.state, nextProps, nextState); | ||
} | ||
return true; | ||
else { | ||
return true; | ||
} | ||
} | ||
@@ -336,3 +331,4 @@ /* | ||
onLeafMouseDown: React.PropTypes.func, | ||
onLeafMouseUp: React.PropTypes.func | ||
onLeafMouseUp: React.PropTypes.func, | ||
shouldComponentUpdate: React.PropTypes.func | ||
}; | ||
@@ -339,0 +335,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
260607
25
1319
243
0