diff --git a/.changeset/eighty-ligers-punch.md b/.changeset/eighty-ligers-punch.md new file mode 100644 index 000000000000..ee7acbec3b87 --- /dev/null +++ b/.changeset/eighty-ligers-punch.md @@ -0,0 +1,5 @@ +--- +'@astrojs/svelte': patch +--- + +Fixes an Reference Error that occurred during client transitions diff --git a/packages/integrations/svelte/client-v5.js b/packages/integrations/svelte/client-v5.js index 78bab3ea34b3..7a046b5bfd08 100644 --- a/packages/integrations/svelte/client-v5.js +++ b/packages/integrations/svelte/client-v5.js @@ -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 }); }; };