Skip to content

Commit 1768798

Browse files
psychedelicioushipsterusername
authored andcommitted
fix(ui): staging alerts should not display on workflows/upscaling tabs if not actively generating to canvas
1 parent c473737 commit 1768798

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

invokeai/frontend/web/src/features/controlLayers/components/CanvasAlerts/CanvasAlertsSendingTo.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
} from 'features/controlLayers/store/ephemeral';
99
import { useImageViewer } from 'features/gallery/components/ImageViewer/useImageViewer';
1010
import { useCurrentDestination } from 'features/queue/hooks/useCurrentDestination';
11+
import { selectActiveTab } from 'features/ui/store/uiSelectors';
1112
import { setActiveTab } from 'features/ui/store/uiSlice';
1213
import { AnimatePresence, motion } from 'framer-motion';
1314
import type { PropsWithChildren, ReactNode } from 'react';
@@ -30,13 +31,18 @@ const ActivateImageViewerButton = (props: PropsWithChildren) => {
3031
export const CanvasAlertsSendingToGallery = () => {
3132
const { t } = useTranslation();
3233
const destination = useCurrentDestination();
34+
const tab = useAppSelector(selectActiveTab);
3335
const isVisible = useMemo(() => {
36+
// This alert should only be visible when the destination is gallery and the tab is canvas
37+
if (tab !== 'canvas') {
38+
return false;
39+
}
3440
if (!destination) {
3541
return false;
3642
}
3743

3844
return destination === 'gallery';
39-
}, [destination]);
45+
}, [destination, tab]);
4046

4147
return (
4248
<AlertWrapper
@@ -68,7 +74,13 @@ export const CanvasAlertsSendingToCanvas = () => {
6874
const { t } = useTranslation();
6975
const destination = useCurrentDestination();
7076
const isStaging = useAppSelector(selectIsStaging);
77+
const tab = useAppSelector(selectActiveTab);
7178
const isVisible = useMemo(() => {
79+
// When we are on a non-canvas tab, and the current generation's destination is not the canvas, we don't show the alert
80+
// For example, on the workflows tab, when the destinatin is gallery, we don't show the alert
81+
if (tab !== 'canvas' && destination !== 'canvas') {
82+
return false;
83+
}
7284
if (isStaging) {
7385
return true;
7486
}
@@ -78,7 +90,7 @@ export const CanvasAlertsSendingToCanvas = () => {
7890
}
7991

8092
return destination === 'canvas';
81-
}, [destination, isStaging]);
93+
}, [destination, isStaging, tab]);
8294

8395
return (
8496
<AlertWrapper

0 commit comments

Comments
 (0)