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

Commit a2b3f5e

Browse files
committed
fix sizing
1 parent 6d1e94a commit a2b3f5e

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/components/HeaderMenu.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,21 @@ const HeaderMenu = (headerMenuProps: HeaderMenuProps) => {
101101
setLabelStateInvalid(true);
102102
return;
103103
}
104-
const futureOrder = table
104+
105+
// Update state of ordered
106+
const updateOrderWithNewKey = table
105107
.getAllColumns()
106108
.map((o: any) => (o.id === column.id ? newKey : o.id));
107-
table.setColumnOrder(futureOrder);
109+
table.setColumnOrder(updateOrderWithNewKey);
110+
111+
// Update state of sizing
112+
const updateSizeWithNewKey: Record<string, number> = {};
113+
table.getAllColumns().forEach((o: any) => {
114+
const key = o.id === column.id ? newKey : o.id;
115+
updateSizeWithNewKey[key] = o.getSize();
116+
});
117+
table.setColumnSizing(updateSizeWithNewKey);
118+
108119
setkeyState(newKey);
109120
dispatch({
110121
type: ActionTypes.UPDATE_COLUMN_LABEL,
@@ -114,6 +125,7 @@ const HeaderMenu = (headerMenuProps: HeaderMenuProps) => {
114125
label: labelState,
115126
});
116127
}
128+
117129
function handleKeyDown(e: any) {
118130
if (e.key === "Enter") {
119131
persistLabelChange();

src/components/reducers/DatabaseDispatch.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ export function databaseReducer(state: TableDataType, action: any) {
134134
const update_column_label_index = state.columns.findIndex(
135135
(column: any) => column.id === action.columnId
136136
);
137+
137138
// Update configuration & row files on disk
138139
state.view.diskConfig.updateColumnKey(
139140
action.columnId,

0 commit comments

Comments
 (0)