Skip to content

Commit

Permalink
Merge pull request #577 from jbetancur/fix/574
Browse files Browse the repository at this point in the history
fix pagination issues when used with enclosing flex | performance
  • Loading branch information
jbetancur authored May 19, 2020
2 parents e80d3bc + 6d1e276 commit 8d85692
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 113 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-data-table-component",
"version": "6.9.1",
"version": "6.9.2",
"description": "A declarative react based data table",
"main": "dist/index.cjs.js",
"module": "dist/index.es.js",
Expand Down
7 changes: 3 additions & 4 deletions src/DataTable/TableColCheckbox.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useCallback } from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import { useTableContext } from './DataTableContext';
Expand All @@ -25,19 +25,18 @@ const TableColCheckbox = ({ head }) => {
keyField,
mergeSelections,
} = useTableContext();

const indeterminate = selectedRows.length > 0 && !allSelected;
const rows = selectableRowDisabled ? data.filter(row => !selectableRowDisabled(row)) : data;
const isDisabled = rows.length === 0;
const rowCount = data.length;

const handleSelectAll = () => dispatch({
const handleSelectAll = useCallback(() => dispatch({
type: 'SELECT_ALL_ROWS',
rows,
rowCount,
mergeSelections,
keyField,
});
}), [dispatch, keyField, mergeSelections, rowCount, rows]);

return (
<TableColStyle className="rdt_TableCol" head={head} noPadding>
Expand Down
1 change: 0 additions & 1 deletion src/DataTable/TableWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import styled from 'styled-components';
const TableWrapper = styled.div`
position: relative;
width: 100%;
height: 100%;
${props => props.theme.tableWrapper.style};
`;

Expand Down
Loading

0 comments on commit 8d85692

Please sign in to comment.