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