Browse Source

refac: channel modal

Timothy Jaeryang Baek 2 weeks ago
parent
commit
700894a13d
1 changed files with 12 additions and 2 deletions
  1. 12 2
      src/lib/components/layout/Sidebar/ChannelModal.svelte

+ 12 - 2
src/lib/components/layout/Sidebar/ChannelModal.svelte

@@ -44,8 +44,12 @@
 		accessControl = channel.access_control;
 	};
 
-	$: if (channel) {
-		init();
+	$: if (show) {
+		if (channel) {
+			init();
+		}
+	} else {
+		resetHandler();
 	}
 
 	let showDeleteConfirmDialog = false;
@@ -68,6 +72,12 @@
 
 		show = false;
 	};
+
+	const resetHandler = () => {
+		name = '';
+		accessControl = {};
+		loading = false;
+	};
 </script>
 
 <Modal size="sm" bind:show>