Socket
Socket
Sign inDemoInstall

react-infinity-menu

Package Overview
Dependencies
Maintainers
23
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-infinity-menu - npm Package Compare versions

Comparing version 2.3.0 to 2.4.0

test/should-component-update.js

21

dist/infinity-menu.js

@@ -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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc