فهرست منبع

fix: share chat modal

Timothy J. Baek 1 سال پیش
والد
کامیت
bfd066cc2f
1فایلهای تغییر یافته به همراه10 افزوده شده و 6 حذف شده
  1. 10 6
      src/lib/components/chat/ShareChatModal.svelte

+ 10 - 6
src/lib/components/chat/ShareChatModal.svelte

@@ -54,12 +54,16 @@
 
 	export let show = false;
 
-	onMount(async () => {
-		chatId.subscribe(async (value) => {
-			chat = await getChatById(localStorage.token, value);
-			console.log(chat);
-		});
-	});
+	$: if (show) {
+		(async () => {
+			if ($chatId) {
+				chat = await getChatById(localStorage.token, $chatId);
+			} else {
+				chat = null;
+				console.log(chat);
+			}
+		})();
+	}
 </script>
 
 <Modal bind:show size="sm">