From 99bbc3512e73cf65dcbb738d34c14fc6e0780a5c Mon Sep 17 00:00:00 2001 From: Fuwn Date: Sat, 2 Dec 2023 21:48:32 -0800 Subject: fix(wrapped): better auto adjust --- src/lib/Tools/Wrapped.svelte | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/lib/Tools') diff --git a/src/lib/Tools/Wrapped.svelte b/src/lib/Tools/Wrapped.svelte index 3bfd0312..2ac5dfb2 100644 --- a/src/lib/Tools/Wrapped.svelte +++ b/src/lib/Tools/Wrapped.svelte @@ -37,7 +37,16 @@ includeSpecials = includeSpecials; includeRepeats = includeRepeats; - update().then(() => {}); + update() + .then(() => {}) + .catch(() => {}); + } + $: { + animeList = animeList; + mangaList = mangaList; + highestRatedCount = highestRatedCount; + + new Promise((resolve) => setTimeout(resolve, 1)).then(updateWidth); } const updateWidth = () => { @@ -163,14 +172,6 @@ for (const media of mangaList) { chapters += media.mediaListEntry?.progress || 0; } - - new MutationObserver((_mutations) => updateWidth()).observe( - document.querySelector('#wrapped')!, - { - childList: true, - subtree: true - } - ); }; /* eslint-disable @typescript-eslint/no-explicit-any */ -- cgit v1.2.3