Update nodesSlice.ts

This commit is contained in:
mickr777 2023-07-13 14:40:33 +10:00 committed by GitHub
parent c7dcf1f4a0
commit 99c1d5c044
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -133,6 +133,10 @@ const nodesSlice = createSlice({
loadFileEdges: (state, action: PayloadAction<Edge[]>) => {
state.edges = action.payload;
},
clearNodes: (state) => {
state.nodes = [];
state.edges = [];
},
},
extraReducers: (builder) => {
builder.addCase(receivedOpenAPISchema.fulfilled, (state, action) => {
@ -156,6 +160,7 @@ export const {
setEditorInstance,
loadFileNodes,
loadFileEdges,
clearNodes,
} = nodesSlice.actions;
export default nodesSlice.reducer;