How to use shallowequal - 10 common examples

To help you get started, we’ve selected a few shallowequal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github satya164 / react-navigation-addons / src / enhanceScreen.js View on Github external
shouldComponentUpdate(nextProps) {
      const { state } = this.props.navigation;
      const { state: nextState } = nextProps.navigation;

      // This is a result of a previous `setOptions` call, prevent extra render
      if (state.params) {
        if (
          nextState.params &&
          nextState.params[COUNT_PARAM] === state.params[COUNT_PARAM] + 1
        ) {
          return false;
        }
      }

      return (
        !shallowEqual(this.props, nextProps) ||
        !shallowEqual(this.state, nextState)
      );
    }
github godaner / vm-engine / vm-backend / src / main / resources / static / node_modules / rc-slider / es / Range.js View on Github external
value: function componentWillReceiveProps(nextProps) {
      var _this2 = this;

      if (!('value' in nextProps || 'min' in nextProps || 'max' in nextProps)) return;
      if (this.props.min === nextProps.min && this.props.max === nextProps.max && shallowEqual(this.props.value, nextProps.value)) {
        return;
      }
      var bounds = this.state.bounds;

      var value = nextProps.value || bounds;
      var nextBounds = value.map(function (v) {
        return _this2.trimAlignValue(v, nextProps);
      });
      if (nextBounds.length === bounds.length && nextBounds.every(function (v, i) {
        return v === bounds[i];
      })) return;

      this.setState({ bounds: nextBounds });
      if (bounds.some(function (v) {
        return utils.isValueOutOfRange(v, nextProps);
      })) {
github mlaursen / react-md / documentation / src / components / PropTypesPage / index.jsx View on Github external
},
    } = props;
    const { toolbarTitle } = state.drawer;

    const ids = ['docgens', section, component].filter(id => !!id);
    const docgens = get(state, ids.join('.'), null);

    const nextResult = {
      component,
      section,
      docgens,
      toolbarTitle,
      mobile: state.media.mobile,
      ...actions,
    };
    if (!shallowEqual(result, nextResult)) {
      result = nextResult;
    }

    return result;
  };
})(PropTypesPage);
github arso-project / archipel / packages / ui / src / components / Tree / Tree.js View on Github external
shouldComponentUpdate (prevProps) {
    if (!shallowEqual(prevProps.state, this.props.state) ||
      !shallowEqual(prevProps.path, this.props.path) ||
      !shallowEqual(prevProps.item, this.props.item)) {
      return true
    }
    return false
  }
github Caltech-IPAC / firefly / src / firefly / js / charts / ui / XYPlotPlotly.jsx View on Github external
const dataUpdate = {};
                    const layoutUpdate = {};
                    let dataUpdateTraces = 0;
                    const newXOptions = getXAxisOptions(newParams);
                    const newYOptions = getYAxisOptions(newParams);
                    const oldXOptions = getXAxisOptions(params);
                    const oldYOptions = getYAxisOptions(params);

                    if (newDesc !== desc) {
                         layoutUpdate['title'] =  newDesc;
                         if (!newDesc || !desc) {
                             layoutUpdate['margin.t'] = (newXOptions.xOpposite ? X_TICKLBL_PX : MIN_MARGIN_PX)+(newDesc ? TITLE_PX: 0);
                         }
                     }

                    if (!shallowequal(oldXOptions, newXOptions)) {
                        layoutUpdate['xaxis.title'] = newXOptions.xTitle;
                        layoutUpdate['xaxis.showgrid'] = newXOptions.xGrid;
                        layoutUpdate['xaxis.side'] = newXOptions.xOpposite ? 'top' : 'bottom';
                        layoutUpdate['xaxis.type'] = newXOptions.xLog ? 'log' : 'linear';
                        layoutUpdate['margin.b'] = newXOptions.xOpposite ? MIN_MARGIN_PX : X_TICKLBL_PX;
                        layoutUpdate['margin.t'] = (newXOptions.xOpposite ? X_TICKLBL_PX : MIN_MARGIN_PX)+(newDesc ? TITLE_PX: 0);
                    }
                    if (!shallowequal(oldYOptions, newYOptions)) {
                        layoutUpdate['yaxis.title'] = newYOptions.yTitle;
                        layoutUpdate['yaxis.showgrid'] = newYOptions.yGrid;
                        layoutUpdate['yaxis.type'] = newYOptions.yLog ? 'log' : 'linear';
                        if (oldYOptions.yOpposite !== newYOptions.yOpposite) {
                            layoutUpdate['yaxis.side'] = newYOptions.yOpposite ? 'right' : 'left';
                            layoutUpdate['yaxis.tickprefix'] = newYOptions.yOpposite ? '' : '  ',
                            layoutUpdate['yaxis.ticksuffix'] = newYOptions.yOpposite ? '  ' : '',
                            layoutUpdate['margin.l'] = newYOptions.yOpposite ? MIN_MARGIN_PX : Y_TICKLBL_PX;
github mlaursen / react-md / docs / src / components / Github / AboutRateLimiting.jsx View on Github external
return (state) => {
    const { rateLimits } = state.github;

    const nextResult = { ...actions, rateLimits };
    if (!shallowEqual(result, nextResult)) {
      result = nextResult;
    }

    return result;
  };
})(AboutRateLimiting);
github theKashey / restate / packages / react-redux-restate / src / restate.js View on Github external
const compareProps = (nextProps, currentProps, additionalIgnore = {}) => (
    shallowequal({...nextProps, ...ignoredProps, ...additionalIgnore}, {...currentProps, ...ignoredProps, ...additionalIgnore})
    && deeperProps.reduce((acc, line) => acc && shallowequal(nextProps[line], currentProps[line]), true)
  );
github apendua / ddp-redux / example / todo-web / src / common / utils / ddp.js View on Github external
});
          const newRequestedQueries = stableMap(
            declaredQueries,
            ({ name, params }, key) => {
              const query = queries[key];
              if (query && doNotCreate[query.id]) {
                return query.id;
              }
              return dispatch(
                queryRequest(name, params, {
                  socketId: connection.id,
                }),
              );
            },
          );
          if (!shallowEqual(newRequestedQueries, requestedQueries)) {
            setRequestedQueries(newRequestedQueries);
          }
        };
      },
github keybase / client / shared / chat / conversation / messages / text.desktop.js View on Github external
shouldComponentUpdate (nextProps: Props, nextState: any): boolean {
    return !shallowEqual(this.props, nextProps, (obj, oth, key) => {
      if (['style', 'followingMap'].includes(key)) {
        return shallowEqual(obj, oth)
      }
      if (key === 'metaDataMap') {
        return I.is(obj, oth)
      }
      return undefined
    })
  }
github Paul-Long / fast-table / src / index.js View on Github external
componentWillReceiveProps(nextProps) {
    if (!shallowEqual(nextProps.showStartIndex, this.props.showStartIndex)) {
      this.sizeManager.update({
        _showStartIndex: nextProps.showStartIndex
      });
    }
    if (!shallowEqual(nextProps.rowSelection, this.props.rowSelection)) {
      this.selectManager.updateSelection(nextProps.rowSelection);
    }
    if (!shallowEqual(nextProps.dataSource, this.props.dataSource)) {
      this.dataManager.reset(nextProps.dataSource);
      const dh = this.sizeManager._dataHeight;
      this.selectManager.count = this.selectManager.getKeys(
        this.dataManager.getData()
      ).length;
      this.sizeManager.update({
        _dataHeight: this.dataManager._bodyHeight,
        _dataEmpty: this.dataManager.isEmpty()
      });
      if (dh !== 0 && this.sizeManager._dataHeight === 0) {
        this.sizeManager.update({_scrollTop: 0});
        this.updateScrollTop({scrollTop: 0});
      }
      if (
        nextProps.pullDown &&
        dh < this.sizeManager._dataHeight &&

shallowequal

Like lodash isEqualWith but for shallow equal.

MIT
Latest version published 6 years ago

Package Health Score

67 / 100
Full package analysis

Popular shallowequal functions