From 568e5e4b8d67ba680161ac2f930a6375c5186136 Mon Sep 17 00:00:00 2001 From: Dominik Schulze Waltrup <105162746+schuwa@users.noreply.github.com> Date: Mon, 13 Nov 2023 15:25:28 +0100 Subject: [PATCH] fix: remove unused window check, as onMount only runs client side (#3279) I just checked the svelte docs again and onMount / onDestroy only run [client side](https://svelte.dev/docs/svelte#onmount). I found this out while playing with svelte 5 preview (svelte@next) as it throws an error failing to ssr the page. Removing the check does not change the behavior, so I think it can just be removed --- packages/svelte/src/lib/TolgeeProvider.svelte | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/svelte/src/lib/TolgeeProvider.svelte b/packages/svelte/src/lib/TolgeeProvider.svelte index 7109b56dc2..571a0b21a2 100644 --- a/packages/svelte/src/lib/TolgeeProvider.svelte +++ b/packages/svelte/src/lib/TolgeeProvider.svelte @@ -12,14 +12,12 @@ tolgee, } as TolgeeSvelteContext); - if (typeof window !== 'undefined') { - onMount(() => { - tolgee.run().finally(() => { - isLoading = false - }) - }); - onDestroy(tolgee.stop); - } + onMount(() => { + tolgee.run().finally(() => { + isLoading = false + }) + }); + onDestroy(tolgee.stop); {#if !isLoading }