mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Merge branch 'main' into fix-inpainting
This commit is contained in:
commit
34bff3ba77
@ -13,9 +13,9 @@ import { makeToast } from 'app/components/Toaster';
|
|||||||
import { RootState } from 'app/store/store';
|
import { RootState } from 'app/store/store';
|
||||||
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
||||||
import IAIIconButton from 'common/components/IAIIconButton';
|
import IAIIconButton from 'common/components/IAIIconButton';
|
||||||
import { clearNodes } from 'features/nodes/store/nodesSlice';
|
import { nodeEditorReset } from 'features/nodes/store/nodesSlice';
|
||||||
import { addToast } from 'features/system/store/systemSlice';
|
import { addToast } from 'features/system/store/systemSlice';
|
||||||
import { memo, useRef } from 'react';
|
import { memo, useRef, useCallback } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { FaTrash } from 'react-icons/fa';
|
import { FaTrash } from 'react-icons/fa';
|
||||||
|
|
||||||
@ -27,8 +27,8 @@ const ClearNodesButton = () => {
|
|||||||
|
|
||||||
const nodes = useAppSelector((state: RootState) => state.nodes.nodes);
|
const nodes = useAppSelector((state: RootState) => state.nodes.nodes);
|
||||||
|
|
||||||
const handleConfirmClear = () => {
|
const handleConfirmClear = useCallback(() => {
|
||||||
dispatch(clearNodes());
|
dispatch(nodeEditorReset());
|
||||||
|
|
||||||
dispatch(
|
dispatch(
|
||||||
addToast(
|
addToast(
|
||||||
@ -40,7 +40,7 @@ const ClearNodesButton = () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
onClose();
|
onClose();
|
||||||
};
|
}, [dispatch, t, onClose]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -121,8 +121,9 @@ const nodesSlice = createSlice({
|
|||||||
) => {
|
) => {
|
||||||
state.invocationTemplates = action.payload;
|
state.invocationTemplates = action.payload;
|
||||||
},
|
},
|
||||||
nodeEditorReset: () => {
|
nodeEditorReset: (state) => {
|
||||||
return { ...initialNodesState };
|
state.nodes = [];
|
||||||
|
state.edges = [];
|
||||||
},
|
},
|
||||||
setEditorInstance: (state, action) => {
|
setEditorInstance: (state, action) => {
|
||||||
state.editorInstance = action.payload;
|
state.editorInstance = action.payload;
|
||||||
@ -133,10 +134,6 @@ const nodesSlice = createSlice({
|
|||||||
loadFileEdges: (state, action: PayloadAction<Edge[]>) => {
|
loadFileEdges: (state, action: PayloadAction<Edge[]>) => {
|
||||||
state.edges = action.payload;
|
state.edges = action.payload;
|
||||||
},
|
},
|
||||||
clearNodes: (state) => {
|
|
||||||
state.nodes = [];
|
|
||||||
state.edges = [];
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
extraReducers: (builder) => {
|
extraReducers: (builder) => {
|
||||||
builder.addCase(receivedOpenAPISchema.fulfilled, (state, action) => {
|
builder.addCase(receivedOpenAPISchema.fulfilled, (state, action) => {
|
||||||
@ -160,7 +157,6 @@ export const {
|
|||||||
setEditorInstance,
|
setEditorInstance,
|
||||||
loadFileNodes,
|
loadFileNodes,
|
||||||
loadFileEdges,
|
loadFileEdges,
|
||||||
clearNodes,
|
|
||||||
} = nodesSlice.actions;
|
} = nodesSlice.actions;
|
||||||
|
|
||||||
export default nodesSlice.reducer;
|
export default nodesSlice.reducer;
|
||||||
|
Loading…
Reference in New Issue
Block a user