diff --git a/frontend/src/lib/taskbar/TaskbarSmall.svelte b/frontend/src/lib/taskbar/TaskbarSmall.svelte index 014bd63b..6fb42d1b 100644 --- a/frontend/src/lib/taskbar/TaskbarSmall.svelte +++ b/frontend/src/lib/taskbar/TaskbarSmall.svelte @@ -9,7 +9,7 @@ import { Tooltip } from 'flowbite-svelte'; import { page } from '$app/stores'; import Paginator from '$lib/components/Paginator.svelte'; - import { goto } from '$app/navigation'; + import { queryParam } from 'sveltekit-search-params'; $: pendingTasks = Object.values($taskStatus).filter((task) => task.state === 'pending'); $: runningTasks = Object.values($taskStatus).filter((task) => task.state === 'running'); @@ -17,12 +17,12 @@ $: failedTasks = Object.values($taskStatus).filter((task) => task.state === 'failed'); $: latestTask = Object.values($taskStatus)[Object.values($taskStatus).length - 1]; - let currentPage = $page.url.searchParams.get('task-page'); + let currentPageParam = queryParam('task-page'); + let currentPage = $currentPageParam; - const switchPage = (page: number) => { + const switchPage = async (page: number) => { currentPage = page.toString(); - $page.url.searchParams.set('task-page', page.toString()); - goto(`?${$page.url.searchParams.toString()}`); + currentPageParam.set(currentPage); }; diff --git a/frontend/src/routes/(authenticated)/+layout.ts b/frontend/src/routes/(authenticated)/+layout.ts index 98419af2..66f7b5f1 100644 --- a/frontend/src/routes/(authenticated)/+layout.ts +++ b/frontend/src/routes/(authenticated)/+layout.ts @@ -76,7 +76,7 @@ export const load = (async ({ fetch, url, data }) => { console.error('Error fetching available modules', e); } - const taskPage = parseInt(new URLSearchParams(url.search).get('task-page') || '1'); + const taskPage = parseInt(url.searchParams.get('task-page') || '1'); const tasksPerPage = 20; const { tasks: allTasks, totalCount: totalTaskCount } = await getAllTasks( tasksPerPage,