From c9d9dd8144d30d91cdd1053540a3976c53bc76fd Mon Sep 17 00:00:00 2001 From: CrescentLeaf Date: Sat, 22 Nov 2025 11:26:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E7=BC=AE=E4=BA=86=20ChatFragment=20?= =?UTF-8?q?=E5=8F=AF=E8=83=BD=E5=AD=98=E5=9C=A8=E7=9A=84=E6=80=A7=E8=83=BD?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/ui/chat/ChatFragment.tsx | 4 ++-- client/ui/chat/GroupMembersList.tsx | 9 ++++++--- client/ui/chat/JoinRequestsList.tsx | 9 ++++++--- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/client/ui/chat/ChatFragment.tsx b/client/ui/chat/ChatFragment.tsx index eae0c26..bd07d03 100644 --- a/client/ui/chat/ChatFragment.tsx +++ b/client/ui/chat/ChatFragment.tsx @@ -567,7 +567,7 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC flexDirection: "column", height: "100%", }}> - {tabItemSelected == "GroupMembers" && } + } { @@ -576,7 +576,7 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC flexDirection: "column", height: "100%", }}> - {tabItemSelected == "NewMemberRequests" && } + } { + React.useEffect(() => { async function updateMembers() { const re = await Client.invoke("Chat.getMembers", { token: data.access_token, @@ -38,8 +38,11 @@ export default function GroupMembersList({ } updateMembers() EventBus.on('GroupMembersList.updateMembers', () => updateMembers()) - setTimeout(() => updateMembers(), 15 * 1000) - }) + const id = setTimeout(() => updateMembers(), 15 * 1000) + return () => { + clearTimeout(id) + } + }, [target]) return { + React.useEffect(() => { async function updateJoinRequests() { const re = await Client.invoke("Chat.getJoinRequests", { token: data.access_token, @@ -41,8 +41,11 @@ export default function JoinRequestsList({ } updateJoinRequests() EventBus.on('JoinRequestsList.updateJoinRequests', () => updateJoinRequests()) - setTimeout(() => updateJoinRequests(), 15 * 1000) - }) + const id = setTimeout(() => updateJoinRequests(), 15 * 1000) + return () => { + clearTimeout(id) + } + }, [target]) async function removeJoinRequest(userId: string) { const re = await Client.invoke("Chat.processJoinRequest", {