Skip to content

Commit

Permalink
Fix-component-undefined-svelte-v5 (#12102)
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: Martin Trapp <[email protected]>

---------

Co-authored-by: Martin Trapp <[email protected]>
  • Loading branch information
hermit99 and martrapp authored Oct 5, 2024
1 parent 55e9cd8 commit dcc1e89
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 dcc1e89

Please sign in to comment.