adds onDestroy handler for auto refresh Data Prov
This commit is contained in:
parent
3e615249d7
commit
fd07fd34b9
|
@ -1,5 +1,5 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { getContext } from "svelte"
|
import { getContext, onDestroy } from "svelte"
|
||||||
import { Pagination, ProgressCircle } from "@budibase/bbui"
|
import { Pagination, ProgressCircle } from "@budibase/bbui"
|
||||||
import { fetchData, QueryUtils } from "@budibase/frontend-core"
|
import { fetchData, QueryUtils } from "@budibase/frontend-core"
|
||||||
import type {
|
import type {
|
||||||
|
@ -175,6 +175,10 @@
|
||||||
interval = setInterval(fetch.refresh, Math.max(10000, autoRefresh * 1000))
|
interval = setInterval(fetch.refresh, Math.max(10000, autoRefresh * 1000))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onDestroy(() => {
|
||||||
|
clearInterval(interval) // Clears auto-refresh when navigating away
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div use:styleable={$component.styles} class="container">
|
<div use:styleable={$component.styles} class="container">
|
||||||
|
|
Loading…
Reference in New Issue