mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): fix circular dependency
This commit is contained in:
parent
37c87affd0
commit
7d4a78e470
@ -1,7 +1,7 @@
|
|||||||
import { logger } from 'app/logging/logger';
|
import { logger } from 'app/logging/logger';
|
||||||
import { parseify } from 'common/util/serialize';
|
import { parseify } from 'common/util/serialize';
|
||||||
import { workflowLoadRequested } from 'features/nodes/store/actions';
|
import { workflowLoadRequested } from 'features/nodes/store/actions';
|
||||||
import { workflowLoaded } from 'features/nodes/store/workflowSlice';
|
import { workflowLoaded } from 'features/nodes/store/actions';
|
||||||
import { $flow } from 'features/nodes/store/reactFlowInstance';
|
import { $flow } from 'features/nodes/store/reactFlowInstance';
|
||||||
import {
|
import {
|
||||||
WorkflowMigrationError,
|
WorkflowMigrationError,
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { createAction, isAnyOf } from '@reduxjs/toolkit';
|
import { createAction, isAnyOf } from '@reduxjs/toolkit';
|
||||||
|
import { WorkflowV2 } from 'features/nodes/types/workflow';
|
||||||
import { Graph } from 'services/api/types';
|
import { Graph } from 'services/api/types';
|
||||||
|
|
||||||
export const textToImageGraphBuilt = createAction<Graph>(
|
export const textToImageGraphBuilt = createAction<Graph>(
|
||||||
@ -25,3 +26,7 @@ export const workflowLoadRequested = createAction<{
|
|||||||
export const updateAllNodesRequested = createAction(
|
export const updateAllNodesRequested = createAction(
|
||||||
'nodes/updateAllNodesRequested'
|
'nodes/updateAllNodesRequested'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const workflowLoaded = createAction<WorkflowV2>(
|
||||||
|
'workflow/workflowLoaded'
|
||||||
|
);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
|
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
|
||||||
import { workflowLoaded } from 'features/nodes/store/workflowSlice';
|
import { workflowLoaded } from 'features/nodes/store/actions';
|
||||||
import { SHARED_NODE_PROPERTIES } from 'features/nodes/types/constants';
|
import { SHARED_NODE_PROPERTIES } from 'features/nodes/types/constants';
|
||||||
import {
|
import {
|
||||||
BoardFieldValue,
|
BoardFieldValue,
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { PayloadAction, createSlice } from '@reduxjs/toolkit';
|
import { PayloadAction, createSlice } from '@reduxjs/toolkit';
|
||||||
|
import { workflowLoaded } from 'features/nodes/store/actions';
|
||||||
import { nodeEditorReset, nodesDeleted } from 'features/nodes/store/nodesSlice';
|
import { nodeEditorReset, nodesDeleted } from 'features/nodes/store/nodesSlice';
|
||||||
import { WorkflowsState as WorkflowState } from 'features/nodes/store/types';
|
import { WorkflowsState as WorkflowState } from 'features/nodes/store/types';
|
||||||
import { FieldIdentifier } from 'features/nodes/types/field';
|
import { FieldIdentifier } from 'features/nodes/types/field';
|
||||||
import { WorkflowV2 } from 'features/nodes/types/workflow';
|
|
||||||
import { cloneDeep, isEqual, uniqBy } from 'lodash-es';
|
import { cloneDeep, isEqual, uniqBy } from 'lodash-es';
|
||||||
|
|
||||||
export const initialWorkflowState: WorkflowState = {
|
export const initialWorkflowState: WorkflowState = {
|
||||||
@ -62,13 +62,14 @@ const workflowSlice = createSlice({
|
|||||||
workflowIDChanged: (state, action: PayloadAction<string>) => {
|
workflowIDChanged: (state, action: PayloadAction<string>) => {
|
||||||
state.id = action.payload;
|
state.id = action.payload;
|
||||||
},
|
},
|
||||||
workflowLoaded: (state, action: PayloadAction<WorkflowV2>) => {
|
|
||||||
const { nodes: _nodes, edges: _edges, ...workflow } = action.payload;
|
|
||||||
return cloneDeep(workflow);
|
|
||||||
},
|
|
||||||
workflowReset: () => cloneDeep(initialWorkflowState),
|
workflowReset: () => cloneDeep(initialWorkflowState),
|
||||||
},
|
},
|
||||||
extraReducers: (builder) => {
|
extraReducers: (builder) => {
|
||||||
|
builder.addCase(workflowLoaded, (state, action) => {
|
||||||
|
const { nodes: _nodes, edges: _edges, ...workflow } = action.payload;
|
||||||
|
return cloneDeep(workflow);
|
||||||
|
});
|
||||||
|
|
||||||
builder.addCase(nodesDeleted, (state, action) => {
|
builder.addCase(nodesDeleted, (state, action) => {
|
||||||
action.payload.forEach((node) => {
|
action.payload.forEach((node) => {
|
||||||
state.exposedFields = state.exposedFields.filter(
|
state.exposedFields = state.exposedFields.filter(
|
||||||
@ -92,7 +93,6 @@ export const {
|
|||||||
workflowVersionChanged,
|
workflowVersionChanged,
|
||||||
workflowContactChanged,
|
workflowContactChanged,
|
||||||
workflowIDChanged,
|
workflowIDChanged,
|
||||||
workflowLoaded,
|
|
||||||
workflowReset,
|
workflowReset,
|
||||||
} = workflowSlice.actions;
|
} = workflowSlice.actions;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { useAppToaster } from 'app/components/Toaster';
|
import { useAppToaster } from 'app/components/Toaster';
|
||||||
import { useAppDispatch } from 'app/store/storeHooks';
|
import { useAppDispatch } from 'app/store/storeHooks';
|
||||||
import { useWorkflow } from 'features/nodes/hooks/useWorkflow';
|
import { useWorkflow } from 'features/nodes/hooks/useWorkflow';
|
||||||
import { workflowLoaded } from 'features/nodes/store/workflowSlice';
|
import { workflowLoaded } from 'features/nodes/store/actions';
|
||||||
import { zWorkflowV2 } from 'features/nodes/types/workflow';
|
import { zWorkflowV2 } from 'features/nodes/types/workflow';
|
||||||
import { getWorkflowCopyName } from 'features/workflowLibrary/util/getWorkflowCopyName';
|
import { getWorkflowCopyName } from 'features/workflowLibrary/util/getWorkflowCopyName';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { useAppToaster } from 'app/components/Toaster';
|
import { useAppToaster } from 'app/components/Toaster';
|
||||||
import { useAppDispatch } from 'app/store/storeHooks';
|
import { useAppDispatch } from 'app/store/storeHooks';
|
||||||
import { useWorkflow } from 'features/nodes/hooks/useWorkflow';
|
import { useWorkflow } from 'features/nodes/hooks/useWorkflow';
|
||||||
import { workflowLoaded } from 'features/nodes/store/workflowSlice';
|
import { workflowLoaded } from 'features/nodes/store/actions';
|
||||||
import { zWorkflowV2 } from 'features/nodes/types/workflow';
|
import { zWorkflowV2 } from 'features/nodes/types/workflow';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
Loading…
Reference in New Issue
Block a user