From 47f9c0a502ec9922bcabc730dadecd0c215aef49 Mon Sep 17 00:00:00 2001 From: tisonhuang Date: Wed, 4 Mar 2026 19:39:47 +0800 Subject: [PATCH] fix(chat): keep cross-day browsing after date jump --- src/pages/ChatPage.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/pages/ChatPage.tsx b/src/pages/ChatPage.tsx index ea8c5b3..4cb0bd7 100644 --- a/src/pages/ChatPage.tsx +++ b/src/pages/ChatPage.tsx @@ -2309,14 +2309,15 @@ function ChatPage(props: ChatPageProps) { const handleJumpDateSelect = useCallback((date: Date) => { if (!currentSessionId) return const targetDate = new Date(date) - const start = Math.floor(targetDate.setHours(0, 0, 0, 0) / 1000) const end = Math.floor(targetDate.setHours(23, 59, 59, 999) / 1000) - isDateJumpRef.current = true + // 日期跳转采用“锚点定位”而非“当天过滤”: + // 先定位到当日附近,再允许上下滚动跨天浏览。 + isDateJumpRef.current = false setCurrentOffset(0) - setJumpStartTime(start) + setJumpStartTime(0) setJumpEndTime(end) setShowJumpPopover(false) - void loadMessages(currentSessionId, 0, start, end, true) + void loadMessages(currentSessionId, 0, 0, end, false) }, [currentSessionId, loadMessages]) // 加载更晚的消息