fix: ignore sorts before first manual sort

dev
gravel 2 years ago
parent 5f199c1412
commit 9ce89215a5
Signed by: gravel
GPG Key ID: C0538F3C906B308F

@ -818,8 +818,9 @@ function sortTable(column) {
if (!table) throw new Error("Table missing"); if (!table) throw new Error("Table missing");
const sortState = getSortState(table); const sortState = getSortState(table);
const sortingAsBefore = column === undefined; const sortingAsBefore = column === undefined;
if (!sortState && !sortingAsBefore) { if (!sortState && sortingAsBefore) {
throw new Error("Must supply column on first sort"); // No column supplied on first sort
return;
} }
const sortingNewColumn = column !== sortState?.column; const sortingNewColumn = column !== sortState?.column;
const sortedColumn = column ?? sortState?.column ?? unreachable(); const sortedColumn = column ?? sortState?.column ?? unreachable();

Loading…
Cancel
Save