Skip to content

Commit

Permalink
Fix-component-undefined-svelte-v5 (#12102) (#12129)
Browse files Browse the repository at this point in the history
* - fix: 'component is not defined' error when unmount svelte 5 component

* added changeset

* Moving unmount listener to where the component is defined.

* Update .changeset/eighty-ligers-punch.md



---------

Co-authored-by: Hermit <70563349+hermit99@users.noreply.github.com>
  • Loading branch information
martrapp and hermit99 authored Oct 5, 2024
1 parent 6e1dfeb commit 5bc6223
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/eighty-ligers-punch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/svelte': patch
---

Fixes an Reference Error that occurred during client transitions
3 changes: 1 addition & 2 deletions packages/integrations/svelte/client-v5.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ export default (element) => {
},
});
existingApplications.set(element, component);
element.addEventListener('astro:unmount', () => unmount(component), { once: true });
}

element.addEventListener('astro:unmount', () => unmount(component), { once: true });
};
};

0 comments on commit 5bc6223

Please sign in to comment.