From 3022fdebc24f622a57bf825b0f8b8608c7fffdf7 Mon Sep 17 00:00:00 2001 From: Faisal Amir Date: Fri, 30 May 2025 13:05:06 +0700 Subject: [PATCH] fix: update model id dropdown without refresh (#5144) --- web-app/src/routes/threads/$threadId.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/web-app/src/routes/threads/$threadId.tsx b/web-app/src/routes/threads/$threadId.tsx index 60bae0778..3403656fa 100644 --- a/web-app/src/routes/threads/$threadId.tsx +++ b/web-app/src/routes/threads/$threadId.tsx @@ -28,7 +28,7 @@ function ThreadDetail() { const [isUserScrolling, setIsUserScrolling] = useState(false) const [isAtBottom, setIsAtBottom] = useState(true) const lastScrollTopRef = useRef(0) - const { currentThreadId, getThreadById, setCurrentThreadId } = useThreads() + const { currentThreadId, setCurrentThreadId } = useThreads() const { setCurrentAssistant, assistants } = useAssistant() const { setMessages } = useMessages() const { streamingContent } = useAppState() @@ -39,10 +39,8 @@ function ThreadDetail() { })) ) - const thread = useMemo( - () => getThreadById(threadId), - [threadId, getThreadById] - ) + // Subscribe directly to the thread data to ensure updates when model changes + const thread = useThreads(useShallow((state) => state.threads[threadId])) const scrollContainerRef = useRef(null) const isFirstRender = useRef(true) const messagesCount = useMemo(() => messages?.length ?? 0, [messages])