Skip to content

Commit

Permalink
fix: destroy only if canvas inserted molstar
Browse files Browse the repository at this point in the history
  • Loading branch information
xnought committed May 6, 2024
1 parent 42ba83b commit 984fb01
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions frontend/src/lib/Molstar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,11 @@
}
onDestroy(() => {
loseWebGLContext(divEl.querySelector("canvas")!);
m.plugin.dispose();
subscribe.unsubscribe();
if (divEl && divEl.querySelector("canvas")) {
loseWebGLContext(divEl.querySelector("canvas")!);
m.plugin.dispose();
subscribe.unsubscribe();
}
});
$: {
Expand Down

0 comments on commit 984fb01

Please sign in to comment.