Skip to content

Commit

Permalink
fix going to default set category
Browse files Browse the repository at this point in the history
  • Loading branch information
Robonau committed Jan 17, 2024
1 parent 86fdcde commit 77fc509
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/routes/(app)/(library)/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 77fc509

Please sign in to comment.