aboutsummaryrefslogtreecommitdiff
path: root/src/routes
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-03-05 19:06:09 -0600
committermat <github@matdoes.dev>2022-03-05 19:06:09 -0600
commit3fff52c85f3928668940c2ec6db9745dc4275212 (patch)
tree95c5a97b367b1796447ba6f2b6b24d1b3fa7f6cd /src/routes
parent89ca3281fbba35a8e4ad5e2c9561e1b9206acccd (diff)
downloadskyblock-stats-3fff52c85f3928668940c2ec6db9745dc4275212.tar.gz
skyblock-stats-3fff52c85f3928668940c2ec6db9745dc4275212.tar.bz2
skyblock-stats-3fff52c85f3928668940c2ec6db9745dc4275212.zip
fix
Diffstat (limited to 'src/routes')
-rw-r--r--src/routes/election.svelte15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/routes/election.svelte b/src/routes/election.svelte
index 2c710ce..3937527 100644
--- a/src/routes/election.svelte
+++ b/src/routes/election.svelte
@@ -49,19 +49,14 @@
// invalidate at the end of every minute
async function autoInvalidate(first: boolean) {
- if (browser) {
- // don't invalidate the first time the function is called
- if (!first) await invalidate('')
+ // don't invalidate the first time the function is called
+ if (!first) await invalidate('')
- const lastUpdatedAgo = Date.now() - data.last_updated * 1000
- autoInvalidateTimeout = setTimeout(
- () => autoInvalidate(false),
- lastUpdatedAgo + 10 * 60 * 1000
- )
- }
+ const lastUpdatedAgo = Date.now() - data.last_updated * 1000
+ autoInvalidateTimeout = setTimeout(() => autoInvalidate(false), lastUpdatedAgo + 10 * 60 * 1000)
}
- autoInvalidate(true)
+ if (browser) autoInvalidate(true)
onMount(() => {
destroyed = false