fix(webui): keep history loading until content is ready (#6659)
* fix(webui): keep history loading until content is ready * fix(webui): preserve history content and retry state Share final activity filtering with history readiness and retain completion and fork metadata across bookkeeping pages. Route boundary retries to the failed cursor and publish navigation pages synchronously so concurrent trace details are preserved. Cover real retry gestures, metadata traversal, batched details, and fork boundaries in both directions. * fix(webui): reduce history admission work and release retry pages
This commit is contained in:
1 parent
40e4e8a3fd
commit
efec4a608d
14 files changed
+751
-103
No files matched your search
@@ -16,6 +16,7 @@ import { useMediaQuery } from "@/hooks/useMediaQuery";
|
||||
import { useLocalPreferences } from "@/hooks/useLocalPreferences";
|
||||
import { fmtDateTime, formatMessageHoverTime } from "@/lib/format-time";
|
||||
import { leadingDisplayNoopCount, projectActivityTimeline, type TurnUnit } from "@/lib/activity-timeline";
|
||||
import { filterThreadDisplayUnits } from "@/lib/thread-display-projection";
|
||||
import { withoutSubagentCreateActivity } from "@/lib/subagent-create-activity";
|
||||
import { cn } from "@/lib/utils";
|
||||
import type { CliAppInfo, McpPresetInfo, RetryStatus, SlashCommand, UIMessage } from "@/lib/types";
|
||||
@@ -109,11 +110,7 @@ export function ThreadMessages({
|
||||
const messageListRef = useRef<HTMLDivElement>(null);
|
||||
const mobileActions = useMediaQuery("(max-width: 767px)");
|
||||
const rawUnits = useMemo(() => buildDisplayUnits(messages), [messages]);
|
||||
const units = useMemo(() => rawUnits.map((unit) => unit.type === "activity"
|
||||
? { ...unit, messages: unit.messages.flatMap((message) => {
|
||||
const visible = withoutSubagentCreateActivity(message);
|
||||
return visible ? [visible] : [];
|
||||
}) } : unit), [rawUnits]);
|
||||
const units = useMemo(() => filterThreadDisplayUnits(rawUnits), [rawUnits]);
|
||||
const forkBoundaryAfterUnitIndex = useMemo(() => {
|
||||
if (forkBoundaryMessageCount != null && forkBoundaryMessageCount > 0
|
||||
&& forkBoundaryMessageCount <= leadingDisplayNoopCount(messages)) return -1;
|
||||
|
||||
@@ -577,9 +577,12 @@ export const ThreadViewport = forwardRef<ThreadViewportHandle, ThreadViewportPro
|
||||
- (historySlotRef.current ? HISTORY_HOLD_PX : 0);
|
||||
const delta = nextOffset - anchor.offsetTop;
|
||||
if (Math.abs(delta) < 0.5) return true;
|
||||
const nextTop = Math.min(maxScrollTop, Math.max(0, scroller.scrollTop + delta));
|
||||
const requestedTop = scroller.scrollTop + delta;
|
||||
const nextTop = Math.min(maxScrollTop, Math.max(0, requestedTop));
|
||||
threadMotionRef.current?.jumpTo(nextTop);
|
||||
anchor.scrollTop = scroller.scrollTop;
|
||||
// A clamped layout is the new reading position, not space owed by a later prepend.
|
||||
anchor.offsetTop += requestedTop - nextTop;
|
||||
return true;
|
||||
}, [captureHistoryScrollAnchor]);
|
||||
|
||||
|
||||
Reference in new issue
Block a user