mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 19:46:36 +00:00
Fix for #1638
The `onDestroy` hook is also run during SSR, so returning destruction function from `onMount` should do the trick.
This commit is contained in:
parent
afa692c9e0
commit
b9359ec7af
1 changed files with 4 additions and 4 deletions
|
@ -159,12 +159,12 @@
|
||||||
if (parent) {
|
if (parent) {
|
||||||
parent.addEventListener("click", pageClickHandler);
|
parent.addEventListener("click", pageClickHandler);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
onDestroy(() => {
|
return () => {
|
||||||
if (parent) {
|
if (parent) {
|
||||||
parent.removeEventListener("click", pageClickHandler);
|
parent.removeEventListener("click", pageClickHandler);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue