Destroy Chart.js instance on unmount in TimeframesFilter
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -73,7 +73,7 @@
|
|||||||
* duration range selectors.
|
* duration range selectors.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ref, computed, watch, onMounted } from "vue";
|
import { ref, computed, watch, onMounted, onBeforeUnmount } from "vue";
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
import { useAllMapDataStore } from "@/stores/allMapData";
|
import { useAllMapDataStore } from "@/stores/allMapData";
|
||||||
import { Chart, registerables } from "chart.js";
|
import { Chart, registerables } from "chart.js";
|
||||||
@@ -409,4 +409,9 @@ onMounted(() => {
|
|||||||
startTime.value = startMinDate.value;
|
startTime.value = startMinDate.value;
|
||||||
endTime.value = startMaxDate.value;
|
endTime.value = startMaxDate.value;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
chart.value?.destroy();
|
||||||
|
chart.value = null;
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user