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

Commit 4c6ed4b

Browse files
committed
finally is updating the columns
1 parent 90e2098 commit 4c6ed4b

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/components/Table.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const defaultColumn: Partial<ColumnDef<RowDataType>> = {
5757
export function Table(tableData: TableDataType) {
5858
/** Main information about the table */
5959
const { view, tableStore } = tableData;
60-
const columns = tableStore.columns((state) => state.columns);
60+
const [columns] = tableStore.columns((state) => [state.columns]);
6161
const [rows, addRow] = tableStore.data((state) => [state.rows, state.addRow]);
6262
LOGGER.debug(
6363
`=> Table. number of columns: ${columns.length}. number of rows: ${rows.length}`

src/stateManagement/useColumnsStore.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,13 @@ const useColumnsStore = (view: DatabaseView) => {
106106
// If the type is the same, do nothing
107107
return {};
108108
}
109+
110+
const alteredColumns = [...updater.columns];
109111
// Save the new type in the disk config
110112
view.diskConfig.updateColumnProperties(column.id, {
111113
input: input,
112114
});
113-
updater.columns[typeIndex].input = input;
115+
alteredColumns[typeIndex].input = input;
114116
switch (input) {
115117
case InputType.SELECT:
116118
case InputType.TAGS:
@@ -124,7 +126,7 @@ const useColumnsStore = (view: DatabaseView) => {
124126
});
125127
}
126128
});
127-
updater.columns[typeIndex].options =
129+
alteredColumns[typeIndex].options =
128130
obtainUniqueOptionValues(options);
129131
break;
130132
default:
@@ -138,7 +140,7 @@ const useColumnsStore = (view: DatabaseView) => {
138140
* - CHECKBOX
139141
*/
140142
}
141-
return { columns: updater.columns };
143+
return { columns: alteredColumns };
142144
}),
143145
alterColumnLabel: (column: TableColumn, label: string) =>
144146
set((updater) => {

src/stateManagement/useDataStore.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ const useDataStore = (view: DatabaseView) => {
5656
updateCell: (rowIndex: number, column: TableColumn, value: Literal, columns: TableColumn[], ddbbConfig: LocalSettings, isMovingFile?: boolean) => set((state) => {
5757
const row = { ...state.rows[rowIndex] };
5858
row[column.key] = value;
59-
console.log(ddbbConfig.show_metadata_modified);
6059
if (ddbbConfig.show_metadata_modified) {
6160
row[MetadataColumns.MODIFIED] = DateTime.now();
6261
}

0 commit comments

Comments
 (0)