Merge pull request #16159 from Budibase/BUDI-9297

adds onDestroy handler for auto refresh Data Provider
This commit is contained in:
Mike Sealey 2025-05-16 11:00:10 +01:00 committed by GitHub
commit 0e0a195289
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions

View File

@ -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">