From a45ae0776767844abdba5ad54f1f680f896eeab0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Thu, 16 Jul 2026 11:13:39 +0800 Subject: [PATCH] not show loading on reload to prevent scollable jumpy --- .../useEditorAgentConversation.ts | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/components/image-editor/EditorAgentConversation/useEditorAgentConversation.ts b/src/components/image-editor/EditorAgentConversation/useEditorAgentConversation.ts index 131c959aa..61daf293f 100644 --- a/src/components/image-editor/EditorAgentConversation/useEditorAgentConversation.ts +++ b/src/components/image-editor/EditorAgentConversation/useEditorAgentConversation.ts @@ -191,8 +191,14 @@ export function useEditorAgentConversation({ ); const loadConversation = useCallback( - async (conversationId: string) => { - setIsLoadingMessages(true); + async ( + conversationId: string, + options: { showLoading?: boolean } = {}, + ) => { + const showLoading = options.showLoading ?? true; + if (showLoading) { + setIsLoadingMessages(true); + } setErrorMessage(null); try { const detail = await client.getConversation(conversationId); @@ -204,7 +210,9 @@ export function useEditorAgentConversation({ ); throw error; } finally { - setIsLoadingMessages(false); + if (showLoading) { + setIsLoadingMessages(false); + } } }, [applyConversationDetail, client], @@ -298,7 +306,7 @@ export function useEditorAgentConversation({ if (!conversationId) { return null; } - return loadConversation(conversationId); + return loadConversation(conversationId, { showLoading: false }); }, [loadConversation]); const requestCanvasRefreshForMessages = useCallback( @@ -443,7 +451,9 @@ export function useEditorAgentConversation({ return; } - const detail = await loadConversation(conversationId); + const detail = await loadConversation(conversationId, { + showLoading: false, + }); const updatedMessage = detail.messages.find( (message) => message.id === messageId, );