@tanstack/react-table 8.5.22 → 8.5.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1480,7 +1480,7 @@ const Pagination = {
1480
1480
  table.setPagination(old => {
1481
1481
  let pageIndex = functionalUpdate(updater, old.pageIndex);
1482
1482
  const maxPageIndex = typeof table.options.pageCount === 'undefined' || table.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : table.options.pageCount - 1;
1483
- pageIndex = Math.min(Math.max(0, pageIndex), maxPageIndex);
1483
+ pageIndex = Math.max(0, Math.min(pageIndex, maxPageIndex));
1484
1484
  return {
1485
1485
  ...old,
1486
1486
  pageIndex
@@ -2856,19 +2856,30 @@ function filterRowModelFromLeafs(rowsToFilter, filterRow, table) {
2856
2856
  for (let i = 0; i < rowsToFilter.length; i++) {
2857
2857
  var _row$subRows;
2858
2858
  let row = rowsToFilter[i];
2859
+ const newRow = createRow(table, row.id, row.original, row.index, row.depth);
2860
+ newRow.columnFilters = row.columnFilters;
2859
2861
  if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
2860
- const newRow = createRow(table, row.id, row.original, row.index, row.depth);
2861
- newRow.columnFilters = row.columnFilters;
2862
2862
  newRow.subRows = recurseFilterRows(row.subRows);
2863
- if (!newRow.subRows.length) {
2863
+ row = newRow;
2864
+ if (filterRow(row) && !newRow.subRows.length) {
2865
+ rows.push(row);
2866
+ newFilteredRowsById[row.id] = row;
2867
+ newFilteredRowsById[i] = row;
2868
+ continue;
2869
+ }
2870
+ if (filterRow(row) || newRow.subRows.length) {
2871
+ rows.push(row);
2872
+ newFilteredRowsById[row.id] = row;
2873
+ newFilteredRowsById[i] = row;
2864
2874
  continue;
2865
2875
  }
2876
+ } else {
2866
2877
  row = newRow;
2867
- }
2868
- if (filterRow(row)) {
2869
- rows.push(row);
2870
- newFilteredRowsById[row.id] = row;
2871
- newFilteredRowsById[i] = row;
2878
+ if (filterRow(row)) {
2879
+ rows.push(row);
2880
+ newFilteredRowsById[row.id] = row;
2881
+ newFilteredRowsById[i] = row;
2882
+ }
2872
2883
  }
2873
2884
  }
2874
2885
  return rows;