Skip to content

Commit c8bc11c

Browse files
authored
fix(search): Avoid reassigning derived selectedSort in search sort handler (#1319)
The search page was mutating `selectedSort` even though it is computed via `$derived.by(...)`. This change removes that mutation path and updates only URL params so sort state is recomputed from `page.url` consistently.
1 parent ba75b8f commit c8bc11c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/routes/search/+page.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@
8585
function handleSortChange(value: string) {
8686
if (sortDropdown) sortDropdown.open = false; // Close the dropdown
8787
88-
selectedSort = SORT_OPTIONS.find((opt) => opt.value === value) || SORT_OPTIONS[0];
88+
const nextSort = SORT_OPTIONS.find((opt) => opt.value === value) || SORT_OPTIONS[0];
8989
const newUrl = new URL(page.url);
90-
newUrl.searchParams.set('sort_by', selectedSort.value);
90+
newUrl.searchParams.set('sort_by', nextSort.value);
9191
goto(newUrl.toString());
9292
}
9393

0 commit comments

Comments
 (0)