Skip to content

Commit d2ab668

Browse files
revert(ui): remove post-generation toasts
1 parent 82df16d commit d2ab668

File tree

1 file changed

+0
-54
lines changed

1 file changed

+0
-54
lines changed

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

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
1-
import { Button } from '@invoke-ai/ui-library';
21
import { logger } from 'app/logging/logger';
32
import type { AppDispatch, RootState } from 'app/store/store';
4-
import { useAppDispatch } from 'app/store/storeHooks';
53
import type { SerializableObject } from 'common/types';
64
import { deepClone } from 'common/util/deepClone';
75
import { stagingAreaImageStaged } from 'features/controlLayers/store/canvasStagingAreaSlice';
8-
import { $imageViewerState } from 'features/gallery/components/ImageViewer/useImageViewer';
96
import { boardIdSelected, galleryViewChanged, imageSelected, offsetChanged } from 'features/gallery/store/gallerySlice';
107
import { $nodeExecutionStates, upsertExecutionState } from 'features/nodes/hooks/useExecutionState';
118
import { zNodeStatus } from 'features/nodes/types/invocation';
12-
import { selectShowSendToToasts, showSendToToastsChanged } from 'features/system/store/systemSlice';
13-
import { toast } from 'features/toast/toast';
14-
import { selectActiveTab } from 'features/ui/store/uiSelectors';
15-
import { useCallback } from 'react';
16-
import { useTranslation } from 'react-i18next';
179
import { boardsApi } from 'services/api/endpoints/boards';
1810
import { getImageDTO, imagesApi } from 'services/api/endpoints/images';
1911
import type { ImageDTO, S } from 'services/api/types';
@@ -25,55 +17,13 @@ const isCanvasOutputNode = (data: S['InvocationCompleteEvent']) => {
2517
return data.invocation_source_id.split(':')[0] === 'canvas_output';
2618
};
2719

28-
const SEND_TO_TOAST_ID = 'send-to-toast';
29-
30-
const DontShowMeTheseToastDescription = () => {
31-
const { t } = useTranslation();
32-
const dispatch = useAppDispatch();
33-
const onClick = useCallback(() => {
34-
dispatch(showSendToToastsChanged(false));
35-
}, [dispatch]);
36-
37-
return (
38-
<Button onClick={onClick} size="sm" variant="link" color="base.50">
39-
{t('common.dontShowMeThese')}
40-
</Button>
41-
);
42-
};
43-
4420
export const buildOnInvocationComplete = (
4521
getState: () => RootState,
4622
dispatch: AppDispatch,
4723
nodeTypeDenylist: string[],
4824
setLastProgressEvent: (event: S['InvocationDenoiseProgressEvent'] | null) => void,
4925
setLastCanvasProgressEvent: (event: S['InvocationDenoiseProgressEvent'] | null) => void
5026
) => {
51-
const toastIfUserIsLost = (destination: string | null) => {
52-
const state = getState();
53-
const showToasts = selectShowSendToToasts(state);
54-
if (!showToasts) {
55-
return;
56-
}
57-
const tab = selectActiveTab(state);
58-
if (destination === 'canvas' && ($imageViewerState.get() || tab !== 'generation')) {
59-
toast({
60-
id: SEND_TO_TOAST_ID,
61-
title: 'Image sent to Canvas',
62-
updateDescription: true,
63-
withCount: false,
64-
description: <DontShowMeTheseToastDescription />,
65-
});
66-
} else if (destination !== 'canvas' && !$imageViewerState.get() && tab === 'generation') {
67-
toast({
68-
id: SEND_TO_TOAST_ID,
69-
title: 'Image sent to Gallery',
70-
updateDescription: true,
71-
withCount: false,
72-
description: <DontShowMeTheseToastDescription />,
73-
});
74-
}
75-
};
76-
7727
const addImageToGallery = (imageDTO: ImageDTO) => {
7828
if (imageDTO.is_intermediate) {
7929
return;
@@ -160,7 +110,6 @@ export const buildOnInvocationComplete = (
160110

161111
if (imageDTO && !imageDTO.is_intermediate) {
162112
addImageToGallery(imageDTO);
163-
toastIfUserIsLost(data.destination);
164113
}
165114
};
166115

@@ -180,13 +129,11 @@ export const buildOnInvocationComplete = (
180129
dispatch(stagingAreaImageStaged({ stagingAreaImage: { imageDTO, offsetX: 0, offsetY: 0 } }));
181130
}
182131
addImageToGallery(imageDTO);
183-
toastIfUserIsLost(data.destination);
184132
}
185133
} else if (!imageDTO.is_intermediate) {
186134
// session.mode === 'generate'
187135
setLastCanvasProgressEvent(null);
188136
addImageToGallery(imageDTO);
189-
toastIfUserIsLost(data.destination);
190137
}
191138
};
192139

@@ -195,7 +142,6 @@ export const buildOnInvocationComplete = (
195142

196143
if (imageDTO && !imageDTO.is_intermediate) {
197144
addImageToGallery(imageDTO);
198-
toastIfUserIsLost(data.destination);
199145
}
200146
};
201147

0 commit comments

Comments
 (0)