@tanstack/table-core 8.5.8 → 8.5.9

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tanstack/table-core",
3
3
  "author": "Tanner Linsley",
4
- "version": "8.5.8",
4
+ "version": "8.5.9",
5
5
  "description": "Headless UI for building powerful tables & datagrids for TS/JS.",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/tanstack/table#readme",
@@ -14,14 +14,18 @@ export function getExpandedRowModel<TData extends RowData>(): (
14
14
  (expanded, rowModel, paginateExpandedRows) => {
15
15
  if (
16
16
  !rowModel.rows.length ||
17
- // Do not expand if rows are not included in pagination
18
- !paginateExpandedRows ||
19
17
  (expanded !== true && !Object.keys(expanded ?? {}).length)
20
18
  ) {
21
19
  return rowModel
22
20
  }
23
21
 
24
- return expandRows(rowModel, table)
22
+ if (!paginateExpandedRows) {
23
+ // Only expand rows at this point if they are being paginated
24
+ console.log(rowModel.rows)
25
+ return rowModel
26
+ }
27
+
28
+ return expandRows(rowModel)
25
29
  },
26
30
  {
27
31
  key: process.env.NODE_ENV === 'development' && 'getExpandedRowModel',
@@ -30,10 +34,7 @@ export function getExpandedRowModel<TData extends RowData>(): (
30
34
  )
31
35
  }
32
36
 
33
- export function expandRows<TData extends RowData>(
34
- rowModel: RowModel<TData>,
35
- table: Table<TData>
36
- ) {
37
+ export function expandRows<TData extends RowData>(rowModel: RowModel<TData>) {
37
38
  const expandedRows: Row<TData>[] = []
38
39
 
39
40
  const handleRow = (row: Row<TData>) => {
@@ -7,7 +7,13 @@ export function getPaginationRowModel<TData extends RowData>(opts?: {
7
7
  }): (table: Table<TData>) => () => RowModel<TData> {
8
8
  return table =>
9
9
  memo(
10
- () => [table.getState().pagination, table.getPrePaginationRowModel()],
10
+ () => [
11
+ table.getState().pagination,
12
+ table.getPrePaginationRowModel(),
13
+ table.options.paginateExpandedRows
14
+ ? undefined
15
+ : table.getState().expanded,
16
+ ],
11
17
  (pagination, rowModel) => {
12
18
  if (!rowModel.rows.length) {
13
19
  return rowModel
@@ -23,14 +29,11 @@ export function getPaginationRowModel<TData extends RowData>(opts?: {
23
29
  let paginatedRowModel: RowModel<TData>
24
30
 
25
31
  if (!table.options.paginateExpandedRows) {
26
- paginatedRowModel = expandRows(
27
- {
28
- rows,
29
- flatRows,
30
- rowsById,
31
- },
32
- table
33
- )
32
+ paginatedRowModel = expandRows({
33
+ rows,
34
+ flatRows,
35
+ rowsById,
36
+ })
34
37
  } else {
35
38
  paginatedRowModel = {
36
39
  rows,
@@ -39,6 +42,8 @@ export function getPaginationRowModel<TData extends RowData>(opts?: {
39
42
  }
40
43
  }
41
44
 
45
+ console.log(paginatedRowModel.rows)
46
+
42
47
  paginatedRowModel.flatRows = []
43
48
 
44
49
  const handleRow = (row: Row<TData>) => {