diff options
author | mat <github@matdoes.dev> | 2022-03-04 23:08:29 -0600 |
---|---|---|
committer | mat <github@matdoes.dev> | 2022-03-04 23:08:29 -0600 |
commit | 4608b68093821d26f416a57f518dc8cd58ad01ca (patch) | |
tree | ca4a0ea7145c94fa69634c01e23866cc906467ed | |
parent | e2506cac822f0b5ddbc285880c768eda9357e075 (diff) | |
download | skyblock-stats-4608b68093821d26f416a57f518dc8cd58ad01ca.tar.gz skyblock-stats-4608b68093821d26f416a57f518dc8cd58ad01ca.tar.bz2 skyblock-stats-4608b68093821d26f416a57f518dc8cd58ad01ca.zip |
fix svelte error
-rw-r--r-- | src/lib/BackgroundImage.svelte | 7 |
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> |