Skip to content

Commit 73107fa

Browse files
authored
Remove memory leak (#73)
1 parent 946f73b commit 73107fa

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/components/Notifications.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { HTMLAttributes, PropType, SlotsType, TransitionGroup, TransitionGroupProps, computed, defineComponent, onMounted, ref } from 'vue';
1+
import { HTMLAttributes, PropType, SlotsType, TransitionGroup, TransitionGroupProps, computed, defineComponent, onMounted, onUnmounted, ref } from 'vue';
22
import { params } from '@/params';
33
import { Id, listToDirection, emitter, parse } from '@/utils';
44
import defaults from '@/defaults';
@@ -345,6 +345,11 @@ export default defineComponent({
345345
emitter.on('close', closeItem);
346346
});
347347

348+
onUnmounted(() => {
349+
emitter.off('add', addItem);
350+
emitter.off('close', closeItem);
351+
});
352+
348353
if (import.meta.env.DEV) {
349354
expose({
350355
list,

0 commit comments

Comments
 (0)