Skip to content

Commit 6fb8e45

Browse files
feat(ui): do not show canvas progress in viewer
1 parent 637960d commit 6fb8e45

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

invokeai/frontend/web/src/features/gallery/components/ImageViewer/CurrentImagePreview.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { memo, useCallback, useMemo, useRef, useState } from 'react';
1515
import { useTranslation } from 'react-i18next';
1616
import { PiImageBold } from 'react-icons/pi';
1717
import { useGetImageDTOQuery } from 'services/api/endpoints/images';
18-
import { $hasProgress } from 'services/events/setEventListeners';
18+
import { $hasProgress, $isProgressFromCanvas } from 'services/events/setEventListeners';
1919

2020
import ProgressImage from './ProgressImage';
2121

@@ -24,6 +24,7 @@ const CurrentImagePreview = () => {
2424
const shouldShowImageDetails = useAppSelector(selectShouldShowImageDetails);
2525
const imageName = useAppSelector(selectLastSelectedImageName);
2626
const hasDenoiseProgress = useStore($hasProgress);
27+
const isProgressFromCanvas = useStore($isProgressFromCanvas);
2728
const shouldShowProgressInViewer = useAppSelector(selectShouldShowProgressInViewer);
2829

2930
const { currentData: imageDTO } = useGetImageDTOQuery(imageName ?? skipToken);
@@ -61,7 +62,7 @@ const CurrentImagePreview = () => {
6162
justifyContent="center"
6263
position="relative"
6364
>
64-
{hasDenoiseProgress && shouldShowProgressInViewer ? (
65+
{hasDenoiseProgress && !isProgressFromCanvas && shouldShowProgressInViewer ? (
6566
<ProgressImage />
6667
) : (
6768
<IAIDndImage

invokeai/frontend/web/src/features/gallery/components/ImageViewer/ProgressImage.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { createSelector } from '@reduxjs/toolkit';
55
import { useAppSelector } from 'app/store/storeHooks';
66
import { selectSystemSlice } from 'features/system/store/systemSlice';
77
import { memo, useMemo } from 'react';
8-
import { $progressImage } from 'services/events/setEventListeners';
8+
import { $isProgressFromCanvas, $progressImage } from 'services/events/setEventListeners';
99

1010
const selectShouldAntialiasProgressImage = createSelector(
1111
selectSystemSlice,
@@ -14,6 +14,7 @@ const selectShouldAntialiasProgressImage = createSelector(
1414

1515
const CurrentImagePreview = () => {
1616
const progressImage = useStore($progressImage);
17+
const isProgressFromCanvas = useStore($isProgressFromCanvas);
1718
const shouldAntialiasProgressImage = useAppSelector(selectShouldAntialiasProgressImage);
1819

1920
const sx = useMemo<SystemStyleObject>(
@@ -23,7 +24,7 @@ const CurrentImagePreview = () => {
2324
[shouldAntialiasProgressImage]
2425
);
2526

26-
if (!progressImage) {
27+
if (!progressImage || isProgressFromCanvas) {
2728
return null;
2829
}
2930

invokeai/frontend/web/src/services/events/setEventListeners.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const nodeTypeDenylist = ['load_image', 'image'];
4040
export const $lastProgressEvent = atom<S['InvocationDenoiseProgressEvent'] | null>(null);
4141
export const $hasProgress = computed($lastProgressEvent, (val) => Boolean(val));
4242
export const $progressImage = computed($lastProgressEvent, (val) => val?.progress_image ?? null);
43+
export const $isProgressFromCanvas = computed($lastProgressEvent, (val) => val?.destination === 'canvas');
4344

4445
export const setEventListeners = ({ socket, dispatch, getState, setIsConnected }: SetEventListenersArg) => {
4546
socket.on('connect', () => {

0 commit comments

Comments
 (0)