Destroy Chart.js instance on unmount in TimeframesFilter

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-09 17:51:43 +08:00
parent 0f09a723a2
commit 957f875377

View File

@@ -73,7 +73,7 @@
* duration range selectors.
*/
import { ref, computed, watch, onMounted } from "vue";
import { ref, computed, watch, onMounted, onBeforeUnmount } from "vue";
import { storeToRefs } from "pinia";
import { useAllMapDataStore } from "@/stores/allMapData";
import { Chart, registerables } from "chart.js";
@@ -409,4 +409,9 @@ onMounted(() => {
startTime.value = startMinDate.value;
endTime.value = startMaxDate.value;
});
onBeforeUnmount(() => {
chart.value?.destroy();
chart.value = null;
});
</script>