fix(webui): stabilize earlier-history loading and reclaim space (#6349)

* fix(webui): retain smoothly revealed history loading headers

* refactor(webui): simplify history loading feedback

* fix(webui): keep retained history headers clear of preceding text

* fix(webui): reclaim completed history loading space

* refactor(webui): group history projection handoff with navigation

* test(webui): synchronize history motion observations

* fix(webui): collapse history completion geometry handoff
This commit is contained in:
chengyongru authored and GitHub committed 2026-10-21 13:10:05 +08:00
1 parent 73a55e0b2f
commit 743c51e81f
24 files changed
+1658 -356

No files matched your search

@@ -8,14 +8,16 @@ interface ThreadHistoryStatusProps {
loading: boolean;
error: string | null;
exhausted?: boolean;
preview?: boolean;
onRetry: () => void;
className?: string;
}
export const ThreadHistoryStatus = forwardRef<HTMLDivElement, ThreadHistoryStatusProps>(function ThreadHistoryStatus({ loading, error, exhausted = false, onRetry, className }, ref) {
export const ThreadHistoryStatus = forwardRef<HTMLDivElement, ThreadHistoryStatusProps>(function ThreadHistoryStatus({ loading, error, exhausted = false, preview = false, onRetry, className }, ref) {
const { t } = useTranslation();
const state = !loading && error ? "error" : !loading && exhausted ? "exhausted" : "loading";
const label = t(state === "error" ? "thread.history.retryLabel" : `thread.history.${state}`);
const state = loading ? "loading" : error ? "error" : exhausted ? "exhausted" : "ready";
const hidden = state === "ready" && !preview;
const label = state === "ready" ? undefined : t(state === "error" ? "thread.history.retryLabel" : `thread.history.${state}`);
// Blocks adapted from loading.dev (MIT); see THIRD_PARTY_NOTICES.md.
const blocks = <span aria-hidden="true" className="thread-history-blocks">
{Array.from({ length: 9 }, (_, index) => <span key={index}
@@ -25,20 +27,21 @@ export const ThreadHistoryStatus = forwardRef<HTMLDivElement, ThreadHistoryStatu
return (
<div
ref={ref}
className={cn("thread-history-status thread-message-row pointer-events-none absolute inset-x-0 top-0 z-10 flex items-center justify-center", className)}
className={cn("thread-history-status thread-message-row pointer-events-none absolute inset-x-0 top-0 z-10 flex items-center justify-center", hidden && "invisible", className)}
aria-hidden={hidden || undefined}
data-state={state}
>
<div role="status" aria-live="polite" aria-atomic="true">
{state === "exhausted" ? (
<span className="text-xs">{label}</span>
) : (
) : state === "ready" ? blocks : (
<HoverHint content={state === "error" ? error : label} side="bottom">
{loading ? (
<div tabIndex={0} aria-label={label} className="thread-history-control pointer-events-auto rounded-sm outline-none focus-visible:ring-2 focus-visible:ring-ring">
{blocks}<span className="sr-only">{label}</span>
</div>
) : (
<button type="button" aria-label={state === "error" ? label : t("thread.loadEarlier")} onClick={onRetry}
<button type="button" aria-label={label} onClick={onRetry}
className="thread-history-control pointer-events-auto rounded-sm outline-none focus-visible:ring-2 focus-visible:ring-ring">
{blocks}<span className="sr-only">{label}</span>
</button>