mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-04-23 03:00:31 -04:00
refactor(ui): merge the workflow and nodes slices
This allows undo/redo history to apply to node editor and workflow details/form.
This commit is contained in:
@@ -5,7 +5,7 @@ import { buildUseDisclosure } from 'common/hooks/useBoolean';
|
||||
import { useDoesWorkflowHaveUnsavedChanges } from 'features/nodes/components/sidePanel/workflow/IsolatedWorkflowBuilderWatcher';
|
||||
import { nodeEditorReset } from 'features/nodes/store/nodesSlice';
|
||||
import { useWorkflowLibraryModal } from 'features/nodes/store/workflowLibraryModal';
|
||||
import { workflowModeChanged } from 'features/nodes/store/workflowSlice';
|
||||
import { workflowModeChanged } from 'features/nodes/store/workflowLibrarySlice';
|
||||
import { toast } from 'features/toast/toast';
|
||||
import { memo, useCallback } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
workflowCategoryChanged,
|
||||
workflowIDChanged,
|
||||
workflowNameChanged,
|
||||
} from 'features/nodes/store/workflowSlice';
|
||||
} from 'features/nodes/store/nodesSlice';
|
||||
import type { WorkflowV3 } from 'features/nodes/types/workflow';
|
||||
import { useGetFormFieldInitialValues } from 'features/workflowLibrary/hooks/useGetFormInitialValues';
|
||||
import { newWorkflowSaved } from 'features/workflowLibrary/store/actions';
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
import { useAppStore } from 'app/store/nanostores/store';
|
||||
import { getFormFieldInitialValues as _getFormFieldInitialValues } from 'features/nodes/store/nodesSlice';
|
||||
import { selectNodesSlice } from 'features/nodes/store/selectors';
|
||||
import {
|
||||
getFormFieldInitialValues as _getFormFieldInitialValues,
|
||||
selectWorkflowForm,
|
||||
} from 'features/nodes/store/workflowSlice';
|
||||
import { useCallback } from 'react';
|
||||
|
||||
export const useGetFormFieldInitialValues = () => {
|
||||
const store = useAppStore();
|
||||
|
||||
const getFormFieldInitialValues = useCallback(() => {
|
||||
const form = selectWorkflowForm(store.getState());
|
||||
const { nodes } = selectNodesSlice(store.getState());
|
||||
const { nodes, form } = selectNodesSlice(store.getState());
|
||||
return _getFormFieldInitialValues(form, nodes);
|
||||
}, [store]);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { ToastId } from '@invoke-ai/ui-library';
|
||||
import { useToast } from '@invoke-ai/ui-library';
|
||||
import { useAppDispatch } from 'app/store/storeHooks';
|
||||
import { formFieldInitialValuesChanged } from 'features/nodes/store/workflowSlice';
|
||||
import { formFieldInitialValuesChanged } from 'features/nodes/store/nodesSlice';
|
||||
import type { WorkflowV3 } from 'features/nodes/types/workflow';
|
||||
import { useGetFormFieldInitialValues } from 'features/workflowLibrary/hooks/useGetFormInitialValues';
|
||||
import { workflowUpdated } from 'features/workflowLibrary/store/actions';
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { logger } from 'app/logging/logger';
|
||||
import { useAppDispatch } from 'app/store/storeHooks';
|
||||
import { $nodeExecutionStates } from 'features/nodes/hooks/useNodeExecutionState';
|
||||
import { workflowLoaded } from 'features/nodes/store/actions';
|
||||
import { $templates } from 'features/nodes/store/nodesSlice';
|
||||
import { $templates, workflowLoaded } from 'features/nodes/store/nodesSlice';
|
||||
import { $needsFit } from 'features/nodes/store/reactFlowInstance';
|
||||
import { WorkflowMigrationError, WorkflowVersionError } from 'features/nodes/types/error';
|
||||
import type { WorkflowV3 } from 'features/nodes/types/workflow';
|
||||
|
||||
Reference in New Issue
Block a user