diff --git a/client/ui/chat/ChatFragment.tsx b/client/ui/chat/ChatFragment.tsx index 75d8477..cc00335 100644 --- a/client/ui/chat/ChatFragment.tsx +++ b/client/ui/chat/ChatFragment.tsx @@ -41,11 +41,11 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC title: '加載中...' } as Chat) - const [tabItemSelected, setTabItemSelected] = React.useState('Chat') + const [tabItemSelected, setTabItemSelected] = React.useState('None') const tabRef = React.useRef(null) const chatPanelRef = React.useRef(null) useEventListener(tabRef, 'change', () => { - setTabItemSelected(tabRef.current?.value || "Chat") + tabRef.current != null && setTabItemSelected(tabRef.current!.value as string) }) useAsyncEffect(async () => { @@ -57,7 +57,15 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC return checkApiSuccessOrSncakbar(re, "對話錯誤") setChatInfo(re.data as Chat) - loadMore() + await loadMore() + + setTabItemSelected("Chat") + setTimeout(() => { + chatPanelRef.current!.scrollTo({ + top: 10000000000, + behavior: "smooth", + }) + }, 100) }, [target]) const page = React.useRef(0) @@ -131,7 +139,7 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC flexDirection: 'column', overflowY: 'auto', }} {...props}> - 設定 + Work in progress... + + )