Skip to content

Commit 8a17ea5

Browse files
fix: get always latest columns from table ref when columnFilters or filters are changed. (#6823)
1 parent 5fa4629 commit 8a17ea5

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

.changeset/five-clouds-stare.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@refinedev/react-table": patch
3+
---
4+
5+
fix: get always latest `columns` from `table ref` when `columnFilters` or `filters` are changed.

packages/react-table/src/useTable/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,12 @@ export function useTable<
155155
}, [sorting]);
156156

157157
useEffect(() => {
158+
const allColumns = reactTableResult
159+
.getAllColumns()
160+
.map((col) => col.columnDef);
161+
158162
const crudFilters: CrudFilter[] = columnFiltersToCrudFilters({
159-
columns,
163+
columns: allColumns,
160164
columnFilters,
161165
});
162166

0 commit comments

Comments
 (0)