mirror of
https://github.com/hicccc77/WeFlow.git
synced 2026-03-25 07:16:51 +00:00
fix(chat): keep cross-day browsing after date jump
This commit is contained in:
@@ -2309,14 +2309,15 @@ function ChatPage(props: ChatPageProps) {
|
|||||||
const handleJumpDateSelect = useCallback((date: Date) => {
|
const handleJumpDateSelect = useCallback((date: Date) => {
|
||||||
if (!currentSessionId) return
|
if (!currentSessionId) return
|
||||||
const targetDate = new Date(date)
|
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)
|
const end = Math.floor(targetDate.setHours(23, 59, 59, 999) / 1000)
|
||||||
isDateJumpRef.current = true
|
// 日期跳转采用“锚点定位”而非“当天过滤”:
|
||||||
|
// 先定位到当日附近,再允许上下滚动跨天浏览。
|
||||||
|
isDateJumpRef.current = false
|
||||||
setCurrentOffset(0)
|
setCurrentOffset(0)
|
||||||
setJumpStartTime(start)
|
setJumpStartTime(0)
|
||||||
setJumpEndTime(end)
|
setJumpEndTime(end)
|
||||||
setShowJumpPopover(false)
|
setShowJumpPopover(false)
|
||||||
void loadMessages(currentSessionId, 0, start, end, true)
|
void loadMessages(currentSessionId, 0, 0, end, false)
|
||||||
}, [currentSessionId, loadMessages])
|
}, [currentSessionId, loadMessages])
|
||||||
|
|
||||||
// 加载更晚的消息
|
// 加载更晚的消息
|
||||||
|
|||||||
Reference in New Issue
Block a user