From 659d24980c954d6356f4f7d6aba231fa36d8d1eb Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.me>
Date: Fri, 2 Feb 2024 04:38:06 -0800
Subject: fix: destroy height observer on unmount

---
 src/routes/+page.svelte | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

(limited to 'src/routes/+page.svelte')

diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index e7f64654..91e3bb23 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -1,5 +1,5 @@
 <script lang="ts">
-	import { onMount } from 'svelte';
+	import { onDestroy, onMount } from 'svelte';
 	import AnimeList from '$lib/List/Anime/DueAnimeList.svelte';
 	import MangaListTemplate from '$lib/List/Manga/MangaListTemplate.svelte';
 	import UpcomingAnimeList from '$lib/List/Anime/UpcomingAnimeList.svelte';
@@ -15,7 +15,11 @@
 
 	export let data;
 
-	onMount(() => setInterval(createHeightObserver, 0));
+	let heightObserver: NodeJS.Timeout;
+
+	onMount(() => (heightObserver = setInterval(() => createHeightObserver(), 0)));
+
+	onDestroy(() => clearInterval(heightObserver));
 </script>
 
 <HeadTitle />
-- 
cgit v1.2.3

