Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
)
}
})
// By default, the loading text is always present and read by screen readers, even
// when hidden. Hide the loading text completely to prevent it from being read.
const DefaultLoadingComponent = ReactTableDefaults.LoadingComponent
Object.assign(ReactTableDefaults, {
LoadingComponent({ loading, ...rest }) {
return loading ? DefaultLoadingComponent({ loading, ...rest }) : null
}
})
ReactTable.propTypes = fixedReactTablePropTypes
// Prevent unnecessary data updates on table rerenders by doing a deep comparison
// of data props rather than a === comparison. Kind of ugly, but significantly
// increases performance when selecting or expanding rows in a very large table.
ReactTable.prototype.oldComponentWillReceiveProps = ReactTable.prototype.componentWillReceiveProps
ReactTable.prototype.componentWillReceiveProps = function(newProps, newState) {
newProps = { ...newProps }
if (this.props.dataKey && this.props.dataKey === newProps.dataKey) {
newProps.data = this.props.data
newProps.columns = this.props.columns
}
const dataUpdateProps = ['pivotBy', 'sorted', 'filtered']
dataUpdateProps.forEach(name => {
if (JSON.stringify(this.props[name]) === JSON.stringify(newProps[name])) {
newProps[name] = this.props[name]
}