Fix memory leaks from Cytoscape instances not returned/destroyed

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-09 20:53:25 +08:00
parent 9aa60414e7
commit f04da6e278
4 changed files with 25 additions and 6 deletions

View File

@@ -121,7 +121,7 @@
* results with expandable activity sequences.
*/
import { ref, computed, watch, nextTick, useTemplateRef } from "vue";
import { ref, computed, watch, nextTick, useTemplateRef, onBeforeUnmount } from "vue";
import { storeToRefs } from "pinia";
import { useConformanceStore } from "@/stores/conformance";
import cytoscapeMapTrace from "@/module/cytoscapeMapTrace.js";
@@ -151,6 +151,7 @@ const infiniteData = ref(null);
const maxItems = ref(false);
const infiniteFinish = ref(true); // Whether infinite scroll loading is complete
const startNum = ref(0);
const cyTraceInstance = ref(null);
const processMap = ref({
nodes: [],
edges: [],
@@ -364,8 +365,9 @@ function createCy() {
setNodesData();
setEdgesData();
cyTraceInstance.value?.destroy();
if (graphId !== null)
cytoscapeMapTrace(
cyTraceInstance.value = cytoscapeMapTrace(
processMap.value.nodes,
processMap.value.edges,
graphId,
@@ -409,6 +411,10 @@ function handleScroll(event) {
if (overScrollHeight) fetchData();
}
onBeforeUnmount(() => {
cyTraceInstance.value?.destroy();
});
</script>
<style scoped>
@reference "../../../assets/tailwind.css";