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

Commit 0c75422

Browse files
committed
checkpoint
1 parent 3c2f827 commit 0c75422

File tree

2 files changed

+24
-28
lines changed

2 files changed

+24
-28
lines changed

src/components/reducers/DatabaseDispatch.tsx

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export function databaseReducer(state: TableDataType, action: ActionType) {
100100
// trim label will get a valid yaml key
101101
const update_col_key: string = dbTrim(action.label);
102102
// Update configuration & row files on disk
103-
103+
console.log("option label", action.label);
104104
state.view.diskConfig
105105
.updateColumnKey(action.columnId, update_col_key, action.label)
106106
.then(async () => {
@@ -117,33 +117,30 @@ export function databaseReducer(state: TableDataType, action: ActionType) {
117117
);
118118
})
119119
);
120-
// Update state
121-
return {
122-
...state,
123-
skipReset: true,
124-
// Add column visually into the new label
125-
columns: [
126-
...state.columns.slice(0, update_column_label_index),
127-
{
128-
...state.columns[update_column_label_index],
129-
label: action.label,
130-
id: update_col_key,
131-
key: update_col_key,
132-
accessor: update_col_key,
133-
},
134-
...state.columns.slice(
135-
update_column_label_index + 1,
136-
state.columns.length
137-
),
138-
],
139-
// Add data visually into the new label
140-
data: state.data.map((row: RowDataType) => {
141-
row[update_col_key] = row[action.columnId];
142-
delete row[action.columnId];
143-
return row;
144-
}),
145-
};
146120
});
121+
// Update state
122+
return update(state, {
123+
skipReset: { $set: true },
124+
// Add column visually into the new label
125+
columns: {
126+
[update_column_label_index]: {
127+
$merge: {
128+
label: action.label,
129+
id: update_col_key,
130+
key: update_col_key,
131+
accessor: update_col_key,
132+
},
133+
},
134+
},
135+
// Add data visually into the new label
136+
data: {
137+
$set: state.data.map((row: RowDataType) => {
138+
row[update_col_key] = row[action.columnId];
139+
delete row[action.columnId];
140+
return row;
141+
}),
142+
},
143+
});
147144

148145
/**
149146
* Modify type of column and adapt the data.

src/services/DatabaseInfo.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ export default class DatabaseInfo {
7878
currentCol.label = newColumnId;
7979
currentCol.accessor = newColumnId;
8080
currentCol.key = newColumnId;
81-
currentCol.id = newColumnId;
8281
delete this.yaml.columns[oldColumnId];
8382
this.yaml.columns[newColumnId] = currentCol;
8483
// save on disk

0 commit comments

Comments
 (0)