fix: update model id dropdown without refresh (#5144)
This commit is contained in:
parent
426dc2ab87
commit
3022fdebc2
@ -28,7 +28,7 @@ function ThreadDetail() {
|
|||||||
const [isUserScrolling, setIsUserScrolling] = useState(false)
|
const [isUserScrolling, setIsUserScrolling] = useState(false)
|
||||||
const [isAtBottom, setIsAtBottom] = useState(true)
|
const [isAtBottom, setIsAtBottom] = useState(true)
|
||||||
const lastScrollTopRef = useRef(0)
|
const lastScrollTopRef = useRef(0)
|
||||||
const { currentThreadId, getThreadById, setCurrentThreadId } = useThreads()
|
const { currentThreadId, setCurrentThreadId } = useThreads()
|
||||||
const { setCurrentAssistant, assistants } = useAssistant()
|
const { setCurrentAssistant, assistants } = useAssistant()
|
||||||
const { setMessages } = useMessages()
|
const { setMessages } = useMessages()
|
||||||
const { streamingContent } = useAppState()
|
const { streamingContent } = useAppState()
|
||||||
@ -39,10 +39,8 @@ function ThreadDetail() {
|
|||||||
}))
|
}))
|
||||||
)
|
)
|
||||||
|
|
||||||
const thread = useMemo(
|
// Subscribe directly to the thread data to ensure updates when model changes
|
||||||
() => getThreadById(threadId),
|
const thread = useThreads(useShallow((state) => state.threads[threadId]))
|
||||||
[threadId, getThreadById]
|
|
||||||
)
|
|
||||||
const scrollContainerRef = useRef<HTMLDivElement>(null)
|
const scrollContainerRef = useRef<HTMLDivElement>(null)
|
||||||
const isFirstRender = useRef(true)
|
const isFirstRender = useRef(true)
|
||||||
const messagesCount = useMemo(() => messages?.length ?? 0, [messages])
|
const messagesCount = useMemo(() => messages?.length ?? 0, [messages])
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user