Skip to content

Commit

Permalink
fix: fetch task list reliably
Browse files Browse the repository at this point in the history
  • Loading branch information
MSchmoecker committed Dec 26, 2024
1 parent bf28cd4 commit 2fcc506
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions frontend/src/lib/taskbar/TaskbarSmall.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@
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');
$: completedTasks = Object.values($taskStatus).filter((task) => task.state === 'completed');
$: 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);
};
</script>

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/routes/(authenticated)/+layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 2fcc506

Please sign in to comment.