diff --git a/app/client/src/ce/actions/workspaceActions.ts b/app/client/src/ce/actions/workspaceActions.ts index 334c9c8339..4e6c8a4d11 100644 --- a/app/client/src/ce/actions/workspaceActions.ts +++ b/app/client/src/ce/actions/workspaceActions.ts @@ -17,6 +17,12 @@ export const fetchWorkspace = ( }; }; +export const resetCurrentWorkspace = () => { + return { + type: ReduxActionTypes.RESET_CURRENT_WORKSPACE, + }; +}; + export const deleteWorkspace = (workspaceId: string) => { return { type: ReduxActionTypes.DELETE_WORKSPACE_INIT, diff --git a/app/client/src/ce/constants/ReduxActionConstants.tsx b/app/client/src/ce/constants/ReduxActionConstants.tsx index 2b2ae9a9c7..b422002fbc 100644 --- a/app/client/src/ce/constants/ReduxActionConstants.tsx +++ b/app/client/src/ce/constants/ReduxActionConstants.tsx @@ -538,6 +538,7 @@ const ActionTypes = { RUN_FORM_EVALUATION: "RUN_FORM_EVALUATION", SET_LOADING_ENTITIES: "SET_LOADING_ENTITIES", RESET_CURRENT_APPLICATION: "RESET_CURRENT_APPLICATION", + RESET_CURRENT_WORKSPACE: "RESET_CURRENT_WORKSPACE", SELECT_WIDGETS_IN_AREA: "SELECT_WIDGETS_IN_AREA", RESET_APPLICATION_WIDGET_STATE_REQUEST: "RESET_APPLICATION_WIDGET_STATE_REQUEST", diff --git a/app/client/src/ce/reducers/uiReducers/applicationsReducer.tsx b/app/client/src/ce/reducers/uiReducers/applicationsReducer.tsx index c489a6f558..be83f8fb67 100644 --- a/app/client/src/ce/reducers/uiReducers/applicationsReducer.tsx +++ b/app/client/src/ce/reducers/uiReducers/applicationsReducer.tsx @@ -446,7 +446,10 @@ export const handlers = { }, [ReduxActionTypes.RESET_CURRENT_APPLICATION]: ( state: ApplicationsReduxState, - ) => ({ ...state, currentApplication: null }), + ) => ({ + ...state, + currentApplication: null, + }), [ReduxActionTypes.SET_SHOW_APP_INVITE_USERS_MODAL]: ( state: ApplicationsReduxState, action: ReduxAction, diff --git a/app/client/src/ce/reducers/uiReducers/workspaceReducer.ts b/app/client/src/ce/reducers/uiReducers/workspaceReducer.ts index 63057c0a52..6dcb06c269 100644 --- a/app/client/src/ce/reducers/uiReducers/workspaceReducer.ts +++ b/app/client/src/ce/reducers/uiReducers/workspaceReducer.ts @@ -154,6 +154,14 @@ export const handlers = { ) => { draftState.currentWorkspace = action.payload; }, + [ReduxActionTypes.RESET_CURRENT_WORKSPACE]: ( + draftState: WorkspaceReduxState, + ) => { + draftState.currentWorkspace = { + id: "", + name: "", + }; + }, [ReduxActionTypes.FETCH_CURRENT_WORKSPACE]: ( draftState: WorkspaceReduxState, ) => { diff --git a/app/client/src/ce/sagas/WorkspaceSagas.ts b/app/client/src/ce/sagas/WorkspaceSagas.ts index b8c3b1cb01..e3f28f200f 100644 --- a/app/client/src/ce/sagas/WorkspaceSagas.ts +++ b/app/client/src/ce/sagas/WorkspaceSagas.ts @@ -41,6 +41,7 @@ import { DELETE_WORKSPACE_SUCCESSFUL, } from "@appsmith/constants/messages"; import { toast } from "design-system"; +import { resetCurrentWorkspace } from "../actions/workspaceActions"; export function* fetchRolesSaga() { try { @@ -234,6 +235,7 @@ export function* deleteWorkspaceSaga(action: ReduxAction) { yield put({ type: ReduxActionTypes.SAVING_WORKSPACE_INFO, }); + yield put(resetCurrentWorkspace()); const workspaceId: string = action.payload; const response: ApiResponse = yield call( WorkspaceApi.deleteWorkspace,