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:
1 parent
73a55e0b2f
commit
743c51e81f
24 files changed
+1658
-356
No files matched your search
@@ -900,6 +900,7 @@ export function ThreadShell({
|
||||
activeHistoryKeyRef.current = historyKey;
|
||||
const currentUiMessagesRef = useRef<UIMessage[] | null>(null);
|
||||
const uiRevisionRef = useRef(0);
|
||||
const olderPageStartRef = useRef<{ historyKey: string; client: typeof client; visibleFirstId: string | null } | null>(null);
|
||||
const showTemporaryChatControl =
|
||||
!hideHeader && !session && !loading && !!onTemporaryChatEnabledChange;
|
||||
|
||||
@@ -945,6 +946,35 @@ export function ThreadShell({
|
||||
const promptNavigation = usePromptHistory(historyKey, historyVersion, displayMessages);
|
||||
const updateNavigationMessages = promptNavigation.updateMessages;
|
||||
|
||||
const olderPageProjectionPending = Boolean(
|
||||
olderPageStartRef.current?.historyKey === historyKey
|
||||
&& olderPageStartRef.current.client === client
|
||||
&& !loadingOlder
|
||||
&& !olderError
|
||||
&& normalizedHistory[0]?.id !== olderPageStartRef.current.visibleFirstId
|
||||
&& displayMessages[0]?.id !== normalizedHistory[0]?.id,
|
||||
);
|
||||
useLayoutEffect(() => {
|
||||
const pending = olderPageStartRef.current;
|
||||
if (pending && (pending.historyKey !== historyKey || pending.client !== client)) {
|
||||
olderPageStartRef.current = null;
|
||||
}
|
||||
if (!historyKey) {
|
||||
olderPageStartRef.current = null;
|
||||
} else if (loadingOlder) {
|
||||
// The request may finish before this shell commits the rendered projection.
|
||||
if (!olderPageStartRef.current) {
|
||||
olderPageStartRef.current = {
|
||||
historyKey,
|
||||
client,
|
||||
visibleFirstId: normalizedHistory[0]?.id ?? null,
|
||||
};
|
||||
}
|
||||
} else if (olderError || !olderPageProjectionPending) {
|
||||
olderPageStartRef.current = null;
|
||||
}
|
||||
}, [client, displayMessages, historyKey, loadingOlder, olderError, olderPageProjectionPending, normalizedHistory]);
|
||||
|
||||
const loadTraceDetails = useCallback(async (refs: string[]) => {
|
||||
const requestKey = historyKey;
|
||||
if (!requestKey) return;
|
||||
@@ -2101,7 +2131,7 @@ export function ThreadShell({
|
||||
slashCommands={availableSlashCommands}
|
||||
forkBoundaryMessageCount={forkBoundaryMessageCount}
|
||||
hasMoreBefore={hasMoreBefore}
|
||||
loadingOlder={loadingOlder}
|
||||
loadingOlder={loadingOlder || olderPageProjectionPending}
|
||||
olderError={olderError}
|
||||
userMessageOffset={userMessageOffset}
|
||||
onLoadOlder={loadOlder}
|
||||
|
||||
Reference in new issue
Block a user