Skip to content

Commit

Permalink
Merge branch 'feat/sort-columns' into alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
mguellsegarra committed Sep 6, 2024
2 parents 7d2ab05 + a1e9df4 commit 90044ec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/helpers/treeHelper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const getTableColumns = (
return 0;
},
isSortable:
type !== "one2many" && type !== "many2one" && column.isFunction,
type !== "one2many" && type !== "many2one" && !column.isFunction,
};
});
return tableColumns;
Expand Down
12 changes: 9 additions & 3 deletions src/widgets/base/one2many/useOne2manyColumnStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,20 @@ export const useOne2manyColumnStorage = (dataForHash: DataForHashWithModel) => {

const updateColumnState = useDeepCompareCallback(
async (state: ColumnState[]) => {
// sort status for columns should not be stored
const columnStatesWithoutSort = state.map((columnState) => {
const { sort, ...columnStateWithoutSort } = columnState;
return columnStateWithoutSort;
});

if (!remoteUserViewPrefsEnabled) {
return updateLocalColumnState(state);
return updateLocalColumnState(columnStatesWithoutSort);
}
try {
return updateRemoteColumnState(state);
return updateRemoteColumnState(columnStatesWithoutSort);
} catch (err) {
console.error(err);
return updateLocalColumnState(state);
return updateLocalColumnState(columnStatesWithoutSort);
}
},
[dataForHash],
Expand Down

0 comments on commit 90044ec

Please sign in to comment.