feat(canvas): add loading state for agent history retrieval

This commit is contained in:
2026-07-10 23:09:42 +08:00
parent 0363170eab
commit 875fff825c
@@ -2682,6 +2682,7 @@ export function CanvasWorkspace({ projectId, shareAccess = ownerWorkspaceAccess
setAgentHistoryOpen(false);
const currentProject = projectRef.current;
if (currentProject) {
setAgentHistoryLoading(true);
setMessages(visibleAgentMessagesForThread(currentProject, imageGeneratorThreadIdsRef.current, threadId));
void designGateway
.getProjectHistory(currentProject.id, threadId)
@@ -2698,6 +2699,9 @@ export function CanvasWorkspace({ projectId, shareAccess = ownerWorkspaceAccess
})
.catch((err) => {
console.warn("Failed to load agent thread history", err);
})
.finally(() => {
if (selectedAgentThreadIdRef.current === threadId) setAgentHistoryLoading(false);
});
}
};