Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lessondesk/react-table-context

Package Overview
Dependencies
Maintainers
3
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lessondesk/react-table-context - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

16

dist/react-table-context.js

@@ -62,10 +62,8 @@ var React = require('react');

var compareRows = function compareRows(array1, array2, rowFormatter) {
var compareRows = function compareRows(array1, array2, getRowIdentifier) {
if (array1.length !== array2.length) return false;
return array1.every(function (row) {
var _rowFormatter = rowFormatter(row),
key = _rowFormatter.key;
var key = getRowIdentifier(row);
return array2.some(function (row2) {
return key === rowFormatter(row2).key;
return key === getRowIdentifier(row2);
});

@@ -345,4 +343,8 @@ });

autoApplyFilters = _this$props2.autoApplyFilters,
rowFormatter = _this$props2.rowFormatter;
var isSame = compareRows(selected, previous == null ? void 0 : previous.selected, rowFormatter) && compareRows(expanded, previous == null ? void 0 : previous.expanded, rowFormatter);
_this$props2$getRowId = _this$props2.getRowIdentifier,
getRowIdentifier = _this$props2$getRowId === void 0 ? function (_ref4) {
var id = _ref4.id;
return id;
} : _this$props2$getRowId;
var isSame = compareRows(selected, previous == null ? void 0 : previous.selected, getRowIdentifier) && compareRows(expanded, previous == null ? void 0 : previous.expanded, getRowIdentifier);
if (!isSame) this.setState({

@@ -349,0 +351,0 @@ selected: selected,

{
"name": "@lessondesk/react-table-context",
"description": "Flexible Table Provider & Consumer",
"version": "2.0.0",
"version": "2.0.1",
"main": "dist/react-table-context.js",

@@ -6,0 +6,0 @@ "source": "src/index.js",

@@ -8,7 +8,7 @@ import React, { createContext, Component } from 'react'

const compareRows = (array1, array2, rowFormatter) => {
const compareRows = (array1, array2, getRowIdentifier) => {
if (array1.length !== array2.length) return false
return array1.every(row => {
const { key } = rowFormatter(row)
return array2.some(row2 => key === rowFormatter(row2).key)
const key = getRowIdentifier(row)
return array2.some(row2 => key === getRowIdentifier(row2))
})

@@ -60,5 +60,11 @@ }

componentDidUpdate(previous) {
const { selected, expanded, filters, autoApplyFilters, rowFormatter } = this.props
const isSame = compareRows(selected, previous?.selected, rowFormatter) &&
compareRows(expanded, previous?.expanded, rowFormatter)
const {
selected,
expanded,
filters,
autoApplyFilters,
getRowIdentifier = ({ id }) => id
} = this.props
const isSame = compareRows(selected, previous?.selected, getRowIdentifier) &&
compareRows(expanded, previous?.expanded, getRowIdentifier)

@@ -65,0 +71,0 @@ if (!isSame) this.setState({ selected, expanded })

Sorry, the diff of this file is not supported yet

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