Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Commit de7f007

Browse files
committed
saving width (not perfect)
1 parent 6380a26 commit de7f007

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

src/components/Table.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ export function Table(tableData: TableDataType) {
205205
}, 1500)
206206
);
207207

208-
setColumnSizing(updater);
208+
setColumnSizing(list);
209209
},
210210
onColumnOrderChange: setColumnOrder,
211211
globalFilterFn: "includesString",

src/stateManagement/useColumnsStore.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,6 @@ const useColumnsStore = (view: DatabaseView) => {
159159
alterColumnSize: (columnSizing: Record<string, number>) =>
160160
set((updater) => {
161161
const alteredColumns = [...updater.columns];
162-
console.log(
163-
"before",
164-
alteredColumns.map((col) => col.config.size)
165-
);
166162
Object.keys(columnSizing)
167163
.filter((key) => columnSizing[key] !== undefined)
168164
.map((key) => {
@@ -172,14 +168,10 @@ const useColumnsStore = (view: DatabaseView) => {
172168
});
173169
// Persist on memory
174170
const indexCol = alteredColumns.findIndex(
175-
(col: TableColumn) => col.id === key
171+
(col: TableColumn) => col.key === key
176172
);
177-
alteredColumns[indexCol].config.size = columnSizing[key];
173+
alteredColumns[indexCol].width = columnSizing[key];
178174
});
179-
console.log(
180-
"after",
181-
alteredColumns.map((col) => col.config.size)
182-
);
183175
return { columns: alteredColumns };
184176
}),
185177
}));

0 commit comments

Comments
 (0)