From bca95677d280f0ac2e2b94238c973b338e75c992 Mon Sep 17 00:00:00 2001 From: 20120454 Date: Fri, 29 Dec 2023 21:50:48 +0700 Subject: [PATCH] handle delete opening chat thread --- lib/core/widgets/chat_thread.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/core/widgets/chat_thread.dart b/lib/core/widgets/chat_thread.dart index b8cfe94..051c86d 100644 --- a/lib/core/widgets/chat_thread.dart +++ b/lib/core/widgets/chat_thread.dart @@ -50,6 +50,10 @@ class _ChatThreadWidgetState extends State { // Perform deletion logic here // For example, you might call a function to delete the chat thread // deleteChatThread(); + int currentId = _chatStore.id; + if (currentId == widget.id) { + _chatStore.setChatThreadId(-1); + } _chatStore.deleteChatThread(widget.id); Navigator.of(context).pop(); // Close the dialog after deletion },