diff --git a/components/canvas/CanvasChatPanel.tsx b/components/canvas/CanvasChatPanel.tsx index b21e63adc..3267e4dce 100644 --- a/components/canvas/CanvasChatPanel.tsx +++ b/components/canvas/CanvasChatPanel.tsx @@ -8371,8 +8371,35 @@ export function CanvasChatPanel({ streamImageGenerationState?.sameModelRunningCount; const loadingConcurrencyLimit = streamImageGenerationState?.concurrencyLimit; const loadingEstimatedWaitMs = streamImageGenerationState?.estimatedWaitMs; + const canvasGenerationPlaceholderState = + useMemo(() => { + if (!shouldShowImageLoading) return null; + if (streamImageGenerationState) return streamImageGenerationState; + + return { + phase: loadingPhase, + providerType: loadingProviderType, + modelName: loadingModelName, + imageCount: loadingImageCount, + queuePosition: loadingQueuePosition, + sameModelRunningCount: loadingSameModelRunningCount, + concurrencyLimit: loadingConcurrencyLimit, + estimatedWaitMs: loadingEstimatedWaitMs, + }; + }, [ + loadingConcurrencyLimit, + loadingEstimatedWaitMs, + loadingImageCount, + loadingModelName, + loadingPhase, + loadingProviderType, + loadingQueuePosition, + loadingSameModelRunningCount, + shouldShowImageLoading, + streamImageGenerationState, + ]); useEffect(() => { - const streamState = streamImageGenerationStateByChatId[activeChatId] || null; + const streamState = canvasGenerationPlaceholderState; const placeholderId = canvasGenerationPlaceholderByChatIdRef.current[activeChatId]; if (!streamState) { @@ -8504,10 +8531,10 @@ export function CanvasChatPanel({ currentModel?.displayName, currentModel?.providerType, imageParams, + canvasGenerationPlaceholderState, focusCanvasOnNode, removeCanvasGenerationPlaceholders, selectNodes, - streamImageGenerationStateByChatId, updateNode, ]); const renderableVisibleMessages = useMemo(() => {