From 0ad22c54fafa8d85a1f444baf51afa8a3b75a991 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Lipovsk=C3=BD?= Date: Thu, 2 Oct 2025 14:36:25 +0200 Subject: [PATCH] Prevent destroy errors by checking if method exists --- packages/vue/src/composables/useStream.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/vue/src/composables/useStream.ts b/packages/vue/src/composables/useStream.ts index abc1792..93c0625 100644 --- a/packages/vue/src/composables/useStream.ts +++ b/packages/vue/src/composables/useStream.ts @@ -207,8 +207,14 @@ export const useStream = < }); onUnmounted(() => { - stopListening(); - removeCallbacks(); + if (stopListening) { + stopListening(); + } + + if (removeCallbacks) { + removeCallbacks(); + } + window.removeEventListener("beforeunload", cancel); if (!hasListeners(id)) {