From ef93f3d4eba6ead6cc233f3f80ad083ead8cdf5b Mon Sep 17 00:00:00 2001 From: strausr Date: Mon, 29 Jun 2026 08:25:46 -0700 Subject: [PATCH] fix(vue): guard htmlLayerInstance in onUpdated/onUnmounted hooks --- packages/vue/src/components/AdvancedImage.vue | 3 ++- packages/vue/src/components/AdvancedVideo.vue | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/vue/src/components/AdvancedImage.vue b/packages/vue/src/components/AdvancedImage.vue index 876b3eb4..61878e17 100644 --- a/packages/vue/src/components/AdvancedImage.vue +++ b/packages/vue/src/components/AdvancedImage.vue @@ -152,6 +152,7 @@ onMounted(() => { * cloudinaryImage and the state of plugins. */ onUpdated(() => { + if (!htmlLayerInstance) return; cancelCurrentlyRunningPlugins(htmlLayerInstance.htmlPluginState); // call html layer to update the dom again with plugins and reset toBeCanceled htmlLayerInstance.update(props.cldImg, props.plugins, SDKAnalyticsConstants); @@ -161,7 +162,7 @@ onUpdated(() => { * On unmount, we cancel the currently running plugins. */ onUnmounted(() => { - // Safely cancel running events on unmount. + if (!htmlLayerInstance) return; cancelCurrentlyRunningPlugins(htmlLayerInstance.htmlPluginState); }); diff --git a/packages/vue/src/components/AdvancedVideo.vue b/packages/vue/src/components/AdvancedVideo.vue index ca66ca53..8127a5c1 100644 --- a/packages/vue/src/components/AdvancedVideo.vue +++ b/packages/vue/src/components/AdvancedVideo.vue @@ -64,6 +64,7 @@ onMounted(() => { * cloudinaryVideo and the state of plugins. */ onUpdated(() => { + if (!htmlLayerInstance) return; cancelCurrentlyRunningPlugins(htmlLayerInstance.htmlPluginState); // call html layer to update the dom again with plugins and reset toBeCanceled htmlLayerInstance.update( @@ -79,7 +80,7 @@ onUpdated(() => { * On unmount, we cancel the currently running plugins. */ onUnmounted(() => { - // Safely cancel running events on unmount. + if (!htmlLayerInstance) return; cancelCurrentlyRunningPlugins(htmlLayerInstance.htmlPluginState); });