Skip to content

Commit 9402014

Browse files
committed
fix: fixed listeners not getting correctly removed
1 parent 0f19fb3 commit 9402014

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/components/LibRecorder/LibRecorder.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
</div>
6565
</template>
6666
<script setup lang="ts">
67-
import { computed, onMounted, onUnmounted, type PropType, ref, watch, watchPostEffect } from "vue"
67+
import { computed, onBeforeUnmount, onMounted, type PropType, ref, watch, watchPostEffect } from "vue"
6868
6969
import { keys } from "@alanscodelog/utils/keys"
7070
@@ -194,7 +194,7 @@ watchPostEffect(() => {
194194
}
195195
})
196196
197-
onUnmounted(() => {
197+
onBeforeUnmount(() => {
198198
unbindListeners()
199199
})
200200
onMounted(() => {

src/composables/useGlobalResizeObserver.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { onMounted, onUnmounted, type Ref, watch } from "vue"
1+
import { onBeforeUnmount, onMounted, type Ref, watch } from "vue"
22

33
import type { AnyFunction } from "@alanscodelog/utils"
44

@@ -18,7 +18,7 @@ export const useGlobalResizeObserver = (el: Ref<HTMLElement | null>, cb: AnyFunc
1818
}, { immediate: true })
1919
})
2020
// todo is this needed?
21-
onUnmounted(() => {
21+
onBeforeUnmount(() => {
2222
if (el.value) {
2323
globalResizeObserver.unobserve(el.value, cb)
2424
}

0 commit comments

Comments
 (0)