Add event listener cleanup to prevent memory leaks
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -41,7 +41,7 @@
|
|||||||
* scrollable display of check results.
|
* scrollable display of check results.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { reactive, computed } from 'vue';
|
import { reactive, computed, onBeforeUnmount } from 'vue';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { useConformanceStore } from '@/stores/conformance';
|
import { useConformanceStore } from '@/stores/conformance';
|
||||||
import emitter from '@/utils/emitter';
|
import emitter from '@/utils/emitter';
|
||||||
@@ -265,6 +265,17 @@ emitter.on('isRadioActSeqMoreChange', (data) => {
|
|||||||
emitter.on('isRadioActSeqFromToChange', (data) => {
|
emitter.on('isRadioActSeqFromToChange', (data) => {
|
||||||
if(data) reset();
|
if(data) reset();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
emitter.off('actListData');
|
||||||
|
emitter.off('actRadioData');
|
||||||
|
emitter.off('getListSequence');
|
||||||
|
emitter.off('reset');
|
||||||
|
emitter.off('isRadioChange');
|
||||||
|
emitter.off('isRadioProcessScopeChange');
|
||||||
|
emitter.off('isRadioActSeqMoreChange');
|
||||||
|
emitter.off('isRadioActSeqFromToChange');
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
:deep(.disc) {
|
:deep(.disc) {
|
||||||
|
|||||||
@@ -745,6 +745,7 @@ onMounted(() => {
|
|||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
selectedAttName.value = {};
|
selectedAttName.value = {};
|
||||||
|
emitter.off('map-filter-reset');
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@@ -388,9 +388,10 @@ const vClosable = {
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
}
|
}
|
||||||
document.addEventListener('click', handleOutsideClick);
|
document.addEventListener('click', handleOutsideClick);
|
||||||
return () => {
|
el._handleOutsideClick = handleOutsideClick;
|
||||||
document.removeEventListener('click', handleOutsideClick);
|
},
|
||||||
};
|
unmounted(el) {
|
||||||
|
document.removeEventListener('click', el._handleOutsideClick);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user