Timothy J. Baek 8 mesi fa
parent
commit
da1d5ad917
1 ha cambiato i file con 8 aggiunte e 1 eliminazioni
  1. 8 1
      src/lib/components/common/Modal.svelte

+ 8 - 1
src/lib/components/common/Modal.svelte

@@ -1,5 +1,5 @@
 <script lang="ts">
 <script lang="ts">
-	import { onMount } from 'svelte';
+	import { onDestroy, onMount } from 'svelte';
 	import { fade } from 'svelte/transition';
 	import { fade } from 'svelte/transition';
 
 
 	import { flyAndScale } from '$lib/utils/transitions';
 	import { flyAndScale } from '$lib/utils/transitions';
@@ -47,6 +47,13 @@
 		document.body.removeChild(modalElement);
 		document.body.removeChild(modalElement);
 		document.body.style.overflow = 'unset';
 		document.body.style.overflow = 'unset';
 	}
 	}
+
+	onDestroy(() => {
+		show = false;
+		if (modalElement) {
+			document.body.removeChild(modalElement);
+		}
+	});
 </script>
 </script>
 
 
 {#if show}
 {#if show}