Skip to content

Commit 0f59762

Browse files
feat(ui): clicking invoke switches to viewer tab instead of canvas when save all images to gallery is enabled
1 parent df3c051 commit 0f59762

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

invokeai/frontend/web/src/features/queue/hooks/useInvoke.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { enqueueMutationFixedCacheKeyOptions, useEnqueueBatchMutation } from 'se
1515
import { useEnqueueCanvas } from './useEnqueueCanvas';
1616
import { useEnqueueGenerate } from './useEnqueueGenerate';
1717
import { useEnqueueUpscaling } from './useEnqueueUpscaling';
18+
import { selectSaveAllImagesToGallery } from 'features/controlLayers/store/canvasSettingsSlice';
1819

1920
const log = logger('generation');
2021

@@ -26,6 +27,7 @@ export const useInvoke = () => {
2627
const enqueueCanvas = useEnqueueCanvas();
2728
const enqueueGenerate = useEnqueueGenerate();
2829
const enqueueUpscaling = useEnqueueUpscaling();
30+
const saveAllImagesToGallery = useAppSelector(selectSaveAllImagesToGallery);
2931

3032
const [_, { isLoading }] = useEnqueueBatchMutation({
3133
...enqueueMutationFixedCacheKeyOptions,
@@ -62,7 +64,7 @@ export const useInvoke = () => {
6264

6365
const enqueueBack = useCallback(() => {
6466
enqueue(false, false);
65-
if (tabName === 'generate' || tabName === 'upscaling') {
67+
if (tabName === 'generate' || tabName === 'upscaling' || (tabName === 'canvas' && saveAllImagesToGallery)) {
6668
navigationApi.focusPanel(tabName, VIEWER_PANEL_ID);
6769
} else if (tabName === 'workflows') {
6870
// Only switch to viewer if the workflow editor is not currently active
@@ -77,7 +79,7 @@ export const useInvoke = () => {
7779

7880
const enqueueFront = useCallback(() => {
7981
enqueue(true, false);
80-
if (tabName === 'generate' || tabName === 'upscaling') {
82+
if (tabName === 'generate' || tabName === 'upscaling' || (tabName === 'canvas' && saveAllImagesToGallery)) {
8183
navigationApi.focusPanel(tabName, VIEWER_PANEL_ID);
8284
} else if (tabName === 'workflows') {
8385
// Only switch to viewer if the workflow editor is not currently active

0 commit comments

Comments
 (0)