diff options
author | 2024-10-05 13:48:30 +0200 | |
---|---|---|
committer | 2024-10-05 13:48:30 +0200 | |
commit | af8401ebf9e5cbe94ded0d0f745ed1e3ec6f6d8a (patch) | |
tree | cdb267c1ff6ba342a6390610482a6f4b11794960 | |
parent | 5bc6223b1200baba9679a4dafea79c73486c275d (diff) | |
download | astro-af8401ebf9e5cbe94ded0d0f745ed1e3ec6f6d8a.tar.gz astro-af8401ebf9e5cbe94ded0d0f745ed1e3ec6f6d8a.tar.zst astro-af8401ebf9e5cbe94ded0d0f745ed1e3ec6f6d8a.zip |
Fixed an "Uncaught ReferenceError" inside of the @astrojs/vue package (#12116)
* fix(vue): initialized the 'app' variable earlier in the client.js script by assigning the 'appInstance' reference to it so that it is available for the later established 'astro:unmount' event listener
* Add changeset
* fix(vue): reverted the last change and instead moved the 'astro:unmount' event listener to inside of the 'if' statement where the 'app' variable is initialized
---------
Co-authored-by: Matt Kane <m@mk.gg>
-rw-r--r-- | .changeset/wicked-sloths-cry.md | 5 | ||||
-rw-r--r-- | packages/integrations/vue/client.js | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/.changeset/wicked-sloths-cry.md b/.changeset/wicked-sloths-cry.md new file mode 100644 index 000000000..e701bb6b8 --- /dev/null +++ b/.changeset/wicked-sloths-cry.md @@ -0,0 +1,5 @@ +--- +"@astrojs/vue": patch +--- + +Fixes an Reference Error that occurred during client transitions diff --git a/packages/integrations/vue/client.js b/packages/integrations/vue/client.js index b3935752c..4ec2b9e68 100644 --- a/packages/integrations/vue/client.js +++ b/packages/integrations/vue/client.js @@ -44,12 +44,12 @@ export default (element) => await setup(app); app.mount(element, isHydrate); appMap.set(element, appInstance); + element.addEventListener('astro:unmount', () => app.unmount(), { once: true }); } else { appInstance.props = props; appInstance.slots = slots; appInstance.component.$forceUpdate(); } - element.addEventListener('astro:unmount', () => app.unmount(), { once: true }); }; function isAsync(fn) { |