aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-03-04 23:08:29 -0600
committermat <github@matdoes.dev>2022-03-04 23:08:29 -0600
commit4608b68093821d26f416a57f518dc8cd58ad01ca (patch)
treeca4a0ea7145c94fa69634c01e23866cc906467ed /src/lib
parente2506cac822f0b5ddbc285880c768eda9357e075 (diff)
downloadskyblock-stats-4608b68093821d26f416a57f518dc8cd58ad01ca.tar.gz
skyblock-stats-4608b68093821d26f416a57f518dc8cd58ad01ca.tar.bz2
skyblock-stats-4608b68093821d26f416a57f518dc8cd58ad01ca.zip
fix svelte error
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/BackgroundImage.svelte7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/lib/BackgroundImage.svelte b/src/lib/BackgroundImage.svelte
index c059119..19144e2 100644
--- a/src/lib/BackgroundImage.svelte
+++ b/src/lib/BackgroundImage.svelte
@@ -15,8 +15,11 @@
bodyStyle = ''
// hack since sometimes the style is not removed
if (browser) {
- let styleEl = document.getElementById('background-image-style')
- if (styleEl) styleEl.remove()
+ // if we don't wait a frame, svelte gives an error sometimes
+ requestAnimationFrame(() => {
+ let styleEl = document.getElementById('background-image-style')
+ if (styleEl) styleEl.remove()
+ })
}
})
</script>