diff --git a/invokeai/frontend/web/src/app/components/App.tsx b/invokeai/frontend/web/src/app/components/App.tsx index 2d878d96e78..760eddbee8d 100644 --- a/invokeai/frontend/web/src/app/components/App.tsx +++ b/invokeai/frontend/web/src/app/components/App.tsx @@ -16,6 +16,8 @@ import { useStarterModelsToast } from 'features/modelManagerV2/hooks/useStarterM import { configChanged } from 'features/system/store/configSlice'; import { languageSelector } from 'features/system/store/systemSelectors'; import InvokeTabs from 'features/ui/components/InvokeTabs'; +import type { InvokeTabName } from 'features/ui/store/tabMap'; +import { setActiveTab } from 'features/ui/store/uiSlice'; import { AnimatePresence } from 'framer-motion'; import i18n from 'i18n'; import { size } from 'lodash-es'; @@ -34,9 +36,10 @@ interface Props { imageName: string; action: 'sendToImg2Img' | 'sendToCanvas' | 'useAllParameters'; }; + destination?: InvokeTabName | undefined; } -const App = ({ config = DEFAULT_CONFIG, selectedImage }: Props) => { +const App = ({ config = DEFAULT_CONFIG, selectedImage, destination }: Props) => { const language = useAppSelector(languageSelector); const logger = useLogger('system'); const dispatch = useAppDispatch(); @@ -67,6 +70,12 @@ const App = ({ config = DEFAULT_CONFIG, selectedImage }: Props) => { } }, [dispatch, config, logger]); + useEffect(() => { + if (destination) { + dispatch(setActiveTab(destination)); + } + }, [dispatch, destination]); + useEffect(() => { dispatch(appStarted()); }, [dispatch]); diff --git a/invokeai/frontend/web/src/app/components/InvokeAIUI.tsx b/invokeai/frontend/web/src/app/components/InvokeAIUI.tsx index 1dd1a265fb1..0a80b7e92d9 100644 --- a/invokeai/frontend/web/src/app/components/InvokeAIUI.tsx +++ b/invokeai/frontend/web/src/app/components/InvokeAIUI.tsx @@ -19,6 +19,7 @@ import type { PartialAppConfig } from 'app/types/invokeai'; import Loading from 'common/components/Loading/Loading'; import AppDndContext from 'features/dnd/components/AppDndContext'; import type { WorkflowCategory } from 'features/nodes/types/workflow'; +import type { InvokeTabName } from 'features/ui/store/tabMap'; import type { PropsWithChildren, ReactNode } from 'react'; import React, { lazy, memo, useEffect, useMemo } from 'react'; import { Provider } from 'react-redux'; @@ -43,6 +44,7 @@ interface Props extends PropsWithChildren { imageName: string; action: 'sendToImg2Img' | 'sendToCanvas' | 'useAllParameters'; }; + destination?: InvokeTabName; customStarUi?: CustomStarUi; socketOptions?: Partial; isDebugging?: boolean; @@ -62,6 +64,7 @@ const InvokeAIUI = ({ projectUrl, queueId, selectedImage, + destination, customStarUi, socketOptions, isDebugging = false, @@ -218,7 +221,7 @@ const InvokeAIUI = ({ }> - +