From 3ba77d58cd99f9e0142eedb7229b0bf5e90dd295 Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.me>
Date: Fri, 22 Dec 2023 20:53:50 -0800
Subject: fix(anime): call subsplease once

---
 src/lib/List/Anime/AnimeListTemplate.svelte | 55 +++++++++++++++--------------
 1 file changed, 29 insertions(+), 26 deletions(-)

(limited to 'src/lib/List/Anime/AnimeListTemplate.svelte')

diff --git a/src/lib/List/Anime/AnimeListTemplate.svelte b/src/lib/List/Anime/AnimeListTemplate.svelte
index 9b02fa53..957376a1 100644
--- a/src/lib/List/Anime/AnimeListTemplate.svelte
+++ b/src/lib/List/Anime/AnimeListTemplate.svelte
@@ -28,31 +28,31 @@
 	let pendingUpdate: number | null = null;
 </script>
 
-{#await animeLists}
-	{#if previousAnimeList}
-		<CleanAnimeList
-			media={previousAnimeList}
-			{title}
-			bind:animeLists
-			{user}
-			{identity}
-			{endTime}
-			bind:lastUpdatedMedia
-			{completed}
-			bind:previousAnimeList
-			bind:pendingUpdate
-		/>
-	{:else}
-		<ListTitle custom={title} />
+{#await fetch(`/api/subsplease?tz=${Intl.DateTimeFormat().resolvedOptions().timeZone}`).then( (r) => r.json() )}
+	<ListTitle custom={title} />
 
-		<ul><li>Loading ...</li></ul>
-	{/if}
-{:then media}
-	{#await fetch(`/api/subsplease?tz=${Intl.DateTimeFormat().resolvedOptions().timeZone}`).then( (r) => r.json() )}
-		<ListTitle custom={title} />
+	<ul><li>Loading ...</li></ul>
+{:then subsPlease}
+	{#await animeLists}
+		{#if previousAnimeList}
+			<CleanAnimeList
+				media={previousAnimeList}
+				{title}
+				bind:animeLists
+				{user}
+				{identity}
+				{endTime}
+				bind:lastUpdatedMedia
+				{completed}
+				bind:previousAnimeList
+				bind:pendingUpdate
+			/>
+		{:else}
+			<ListTitle custom={title} />
 
-		<ul><li>Loading ...</li></ul>
-	{:then subsPlease}
+			<ul><li>Loading ...</li></ul>
+		{/if}
+	{:then media}
 		<CleanAnimeList
 			media={cleanMedia(media, $settings.displayUnresolved, subsPlease, plannedOnly)}
 			{title}
@@ -62,12 +62,15 @@
 			{endTime}
 			bind:lastUpdatedMedia
 			{completed}
+			{subsPlease}
 			bind:previousAnimeList
 			bind:pendingUpdate
 		/>
+	{:catch}
+		<ListTitle time={0} count={-1337} custom={title} />
+
+		<Error />
 	{/await}
 {:catch}
-	<ListTitle time={0} count={-1337} custom={title} />
-
-	<Error />
+	<Error type="Subtitle release data" />
 {/await}
-- 
cgit v1.2.3

