Skip to content

Commit 2128ce0

Browse files
author
Mishig
authored
[Assistants] Fix selected model reactivity (#784)
1 parent f3c82b6 commit 2128ce0

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/routes/assistants/+page.server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export const load = async ({ url }) => {
3232

3333
return {
3434
assistants: JSON.parse(JSON.stringify(assistants)) as Array<Assistant>,
35+
selectedModel: modelId ?? "",
3536
numTotalItems,
3637
numItemsPerPage: NUM_PER_PAGE,
3738
};

src/routes/assistants/+page.svelte

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
1515
export let data: PageData;
1616
17-
let selectedModel = $page.url.searchParams.get("modelId") ?? "";
18-
1917
const onModelChange = (e: Event) => {
2018
const newUrl = new URL($page.url);
2119
newUrl.search = ""; // clear searchParams (such as "p" for pagination)
@@ -65,7 +63,7 @@
6563
<div class="mt-6 flex justify-between gap-2 max-sm:flex-col sm:items-center">
6664
<select
6765
class="mt-1 h-[34px] rounded-lg border border-gray-300 bg-gray-50 px-2 text-sm text-gray-900 focus:border-blue-700 focus:ring-blue-700 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400"
68-
bind:value={selectedModel}
66+
bind:value={data.selectedModel}
6967
on:change={onModelChange}
7068
>
7169
<option value="">All models</option>

0 commit comments

Comments
 (0)