From 9ce89215a5151955517cb245a3b82f57f615601d Mon Sep 17 00:00:00 2001 From: gravel Date: Thu, 18 Jan 2024 15:40:32 +0000 Subject: [PATCH] fix: ignore sorts before first manual sort --- output/main.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/output/main.js b/output/main.js index 793d04c..73556a9 100644 --- a/output/main.js +++ b/output/main.js @@ -818,8 +818,9 @@ function sortTable(column) { if (!table) throw new Error("Table missing"); const sortState = getSortState(table); const sortingAsBefore = column === undefined; - if (!sortState && !sortingAsBefore) { - throw new Error("Must supply column on first sort"); + if (!sortState && sortingAsBefore) { + // No column supplied on first sort + return; } const sortingNewColumn = column !== sortState?.column; const sortedColumn = column ?? sortState?.column ?? unreachable();