Skip to content

Commit

Permalink
Fixed an "Uncaught ReferenceError" inside of the @astrojs/vue package (
Browse files Browse the repository at this point in the history
…#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>
  • Loading branch information
sammibajrami and ascorbic authored Oct 5, 2024
1 parent 5bc6223 commit af8401e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/wicked-sloths-cry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@astrojs/vue": patch
---

Fixes an Reference Error that occurred during client transitions
2 changes: 1 addition & 1 deletion packages/integrations/vue/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit af8401e

Please sign in to comment.