From 77fc509cd0da4db6d6ce4eb8e117c9f43d66e132 Mon Sep 17 00:00:00 2001 From: robonau <30987265+Robonau@users.noreply.github.com> Date: Wed, 17 Jan 2024 23:54:41 +0000 Subject: [PATCH] fix going to default set category --- src/routes/(app)/(library)/+page.svelte | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/routes/(app)/(library)/+page.svelte b/src/routes/(app)/(library)/+page.svelte index 36044806..a799483f 100644 --- a/src/routes/(app)/(library)/+page.svelte +++ b/src/routes/(app)/(library)/+page.svelte @@ -50,12 +50,16 @@ nextFetchPolicy: 'cache-only' }); - if ($tab === null) { + $: if ($tab === null) { categories.subscribe((e) => { - $tab = e.data?.categories?.nodes.find((ele) => ele.default)?.id ?? 0; + window.requestAnimationFrame(() => { + tab.set(e.data?.categories?.nodes.find((ele) => ele.default && ele.id !== 0)?.id ?? 0); + }); }); } + $: console.log($tab); + $: orderedCategories = [...($categories.data?.categories?.nodes ?? [])] .toSorted((a, b) => { return a.order > b.order ? 1 : -1;