Fixes to Dialog

Fix bad porting from useEffect--needs to run on destroy as well. Also fix a missing function invocation.
This commit is contained in:
Ryan Gossiaux
2021-12-14 12:01:42 -08:00
parent 5468a38a45
commit 5aea8065d3
2 changed files with 32 additions and 4 deletions

View File

@@ -6,7 +6,7 @@
</script>
<script lang="ts">
import { getContext, setContext } from "svelte";
import { getContext, onDestroy, setContext } from "svelte";
import { writable, Writable } from "svelte/store";
type OnUpdate = (message: StackMessage, element: HTMLElement | null) => void;
@@ -34,6 +34,12 @@
$notifyStore(StackMessage.Add, element);
return () => $notifyStore(StackMessage.Remove, element);
})();
onDestroy(() => {
if (_cleanup) {
_cleanup();
}
});
</script>
<slot />