Skip to content

πŸ™Œ OpenHands: AI-Driven Development

refactor(frontend): remove the code-slice.ts file (#11021)

Hiep Lea8a3e9e604ec
diff --git a/frontend/src/state/code-slice.ts b/frontend/src/state/code-slice.ts
deleted file mode 100644
index 72e002d542..0000000000
--- a/frontend/src/state/code-slice.ts
+++ /dev/null
@@ -1,58 +0,0 @@
-import { createSlice } from "@reduxjs/toolkit";
-
-export interface FileState {
- path: string;
- savedContent: string;
- unsavedContent: string;
-}
-
-export const initialState = {
- code: "",
- path: "",
- refreshID: 0,
- fileStates: [] as FileState[],
-};
-
-export const codeSlice = createSlice({
- name: "code",
- initialState,
- reducers: {
- setCode: (state, action) => {
- state.code = action.payload;
- },
- setActiveFilepath: (state, action) => {
- state.path = action.payload;
- },
- setRefreshID: (state, action) => {
- state.refreshID = action.payload;
- },
- setFileStates: (state, action) => {
- state.fileStates = action.payload;
- },
- addOrUpdateFileState: (state, action) => {
- const { path, unsavedContent, savedContent } = action.payload;
- const newFileStates = state.fileStates.filter(
- (fileState) => fileState.path !== path,
- );
- newFileStates.push({ path, savedContent, unsavedContent });
- state.fileStates = newFileStates;
- },
- removeFileState: (state, action) => {
- const path = action.payload;
- state.fileStates = state.fileStates.filter(
- (fileState) => fileState.path !== path,
- );
- },
- },
-});
-
-export const {
- setCode,
- setActiveFilepath,
- setRefreshID,
- addOrUpdateFileState,
- removeFileState,
- setFileStates,
-} = codeSlice.actions;
-
-export default codeSlice.reducer;
diff --git a/frontend/src/store.ts b/frontend/src/store.ts
index b17c0d0a5d..3eb535e774 100644
--- a/frontend/src/store.ts
+++ b/frontend/src/store.ts
@@ -1,7 +1,6 @@
import { combineReducers, configureStore } from "@reduxjs/toolkit";
import agentReducer from "./state/agent-slice";
import browserReducer from "./state/browser-slice";
-import codeReducer from "./state/code-slice";
import fileStateReducer from "./state/file-state-slice";
import initialQueryReducer from "./state/initial-query-slice";
import commandReducer from "./state/command-slice";
@@ -17,7 +16,6 @@ export const rootReducer = combineReducers({
fileState: fileStateReducer,
initialQuery: initialQueryReducer,
browser: browserReducer,
- code: codeReducer,
cmd: commandReducer,
agent: agentReducer,
jupyter: jupyterReducer,