Skip to content

Commit 2bd8d37

Browse files
authored
fix: Cannot read property 'destroy' of undefined in menuSurface
This was a regression in beta18. Sapper calls onDestroy on the server, so we have to check that menuSurface is not undefined before calling destroy()
1 parent b78d2ca commit 2bd8d37

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/menu-surface/MenuSurface.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@
101101
let isHoisted = false;
102102
if (menuSurface) {
103103
isHoisted = menuSurface.foundation_.isHoistedElement_;
104-
}
105-
if (instantiate !== false) {
106-
menuSurface.destroy();
104+
if (instantiate !== false) {
105+
menuSurface.destroy();
106+
}
107107
}
108108
if (isHoisted) {
109109
element.parentNode.removeChild(element);
@@ -156,4 +156,4 @@
156156
export function getDefaultFoundation(...args) {
157157
return menuSurface.getDefaultFoundation(...args);
158158
}
159-
</script>
159+
</script>

0 commit comments

Comments
 (0)