Skip to content

Commit

Permalink
fix: remove unused window check, as onMount only runs client side (#3279
Browse files Browse the repository at this point in the history
)

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
  • Loading branch information
schuwa authored Nov 13, 2023
1 parent 1dd569e commit 568e5e4
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions packages/svelte/src/lib/TolgeeProvider.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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);
</script>

{#if !isLoading }
Expand Down

0 comments on commit 568e5e4

Please sign in to comment.