From 241ff714b8501ac2ea56bf3fda0d400dfb77bfa2 Mon Sep 17 00:00:00 2001 From: CrescentLeaf Date: Wed, 8 Oct 2025 12:25:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AF=B9=E8=AF=9D=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/ui/chat/ChatFragment.tsx | 95 ++++++++++++++++----------------- 1 file changed, 45 insertions(+), 50 deletions(-) diff --git a/client/ui/chat/ChatFragment.tsx b/client/ui/chat/ChatFragment.tsx index e7207ac..9e75438 100644 --- a/client/ui/chat/ChatFragment.tsx +++ b/client/ui/chat/ChatFragment.tsx @@ -25,6 +25,7 @@ import SelectPreference from '../preference/SelectPreference.tsx' import TextFieldPreference from '../preference/TextFieldPreference.tsx' import Preference from '../preference/Preference.tsx' import GroupSettings from "../../api/client_data/GroupSettings.ts" +import PreferenceUpdater from "../preference/PreferenceUpdater.ts"; interface Args extends React.HTMLAttributes { target: string @@ -65,7 +66,6 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC } as Chat) const [tabItemSelected, setTabItemSelected] = React.useState('None') - const [groupPreferenceDefaultValue, setGroupPreferenceDefaultValue] = React.useState({}) const tabRef = React.useRef(null) const chatPanelRef = React.useRef(null) useEventListener(tabRef, 'change', () => { @@ -85,9 +85,7 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC setTabItemSelected("Chat") if (re.data!.type == 'group') { - setGroupPreferenceDefaultValue(re.data!.settings as GroupSettings) - groupPreferenceStore.setter(re.data!.settings as GroupSettings) - console.log(re.data!.settings as GroupSettings) + groupPreferenceStore.setState(re.data!.settings as GroupSettings) } setTimeout(() => { chatPanelRef.current!.scrollTo({ @@ -226,11 +224,6 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC settings: value, }) if (checkApiSuccessOrSncakbar(re, "更新设定失败")) return - - setChatInfo(JSON.parse(JSON.stringify({ - ...chatInfo, - settings: value as object, - }))) }) return ( @@ -456,48 +449,50 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC }}> { chatInfo.type == 'group' && - - - - - - - { - groupPreferenceStore.value.new_member_join_method == 'answered_and_allowed_by_admin' - && + + - } + description="别看了, 还没做" /> + + + + + { + groupPreferenceStore.state.new_member_join_method == 'answered_and_allowed_by_admin' + && + } + } {