diff --git a/app/client/src/components/editorComponents/Debugger/hooks/useDebuggerConfig.ts b/app/client/src/components/editorComponents/Debugger/hooks/useDebuggerConfig.ts index 0318873eca58..54e6373935a1 100644 --- a/app/client/src/components/editorComponents/Debugger/hooks/useDebuggerConfig.ts +++ b/app/client/src/components/editorComponents/Debugger/hooks/useDebuggerConfig.ts @@ -1,61 +1,9 @@ import { useMemo } from "react"; import { useLocation } from "react-router"; -import { - FocusEntity, - type FocusEntityInfo, - identifyEntityFromPath, -} from "navigation/FocusEntity"; +import { identifyEntityFromPath } from "navigation/FocusEntity"; import { useSelector } from "react-redux"; import { getIDEViewMode } from "selectors/ideSelectors"; -import { setCanvasDebuggerState } from "actions/debuggerActions"; -import { getCanvasDebuggerState } from "selectors/debuggerSelectors"; -import { - getPluginActionDebuggerState, - setPluginActionEditorDebuggerState, -} from "PluginActionEditor/store"; -import type { CanvasDebuggerState } from "reducers/uiReducers/debuggerReducer"; -import type { ReduxAction } from "actions/ReduxActionTypes"; -import type { AppState } from "ee/reducers"; -import { EditorViewMode } from "IDE/Interfaces/EditorTypes"; -import { setJsPaneDebuggerState } from "actions/jsPaneActions"; -import { getJsPaneDebuggerState } from "selectors/jsPaneSelectors"; - -interface Config { - set: ( - payload: Partial, - ) => ReduxAction>; - get: (state: AppState) => CanvasDebuggerState; -} - -const canvasDebuggerConfig: Config = { - set: setCanvasDebuggerState, - get: getCanvasDebuggerState, -}; -const pluginActionEditorDebuggerConfig: Config = { - set: setPluginActionEditorDebuggerState, - get: getPluginActionDebuggerState, -}; - -export const getDebuggerPaneConfig = ( - focusInfo: FocusEntityInfo, - ideViewMode: EditorViewMode, -): Config => { - if (ideViewMode === EditorViewMode.SplitScreen) { - return canvasDebuggerConfig; - } - - switch (focusInfo.entity) { - case FocusEntity.QUERY: - return pluginActionEditorDebuggerConfig; - case FocusEntity.JS_OBJECT: - return { - set: setJsPaneDebuggerState, - get: getJsPaneDebuggerState, - }; - default: - return canvasDebuggerConfig; - } -}; +import { getDebuggerPaneConfig } from "../utils/getDebuggerPaneConfig"; export const useDebuggerConfig = () => { const location = useLocation(); diff --git a/app/client/src/components/editorComponents/Debugger/utils/getDebuggerPaneConfig.ts b/app/client/src/components/editorComponents/Debugger/utils/getDebuggerPaneConfig.ts new file mode 100644 index 000000000000..a8a7275f358d --- /dev/null +++ b/app/client/src/components/editorComponents/Debugger/utils/getDebuggerPaneConfig.ts @@ -0,0 +1,50 @@ +import { + getPluginActionDebuggerState, + setPluginActionEditorDebuggerState, +} from "PluginActionEditor/store"; +import { FocusEntity, type FocusEntityInfo } from "navigation/FocusEntity"; +import { EditorViewMode } from "IDE/Interfaces/EditorTypes"; +import { setJsPaneDebuggerState } from "actions/jsPaneActions"; +import { getJsPaneDebuggerState } from "selectors/jsPaneSelectors"; +import type { CanvasDebuggerState } from "reducers/uiReducers/debuggerReducer"; +import type { ReduxAction } from "actions/ReduxActionTypes"; +import type { AppState } from "ee/reducers"; +import { setCanvasDebuggerState } from "actions/debuggerActions"; +import { getCanvasDebuggerState } from "selectors/debuggerSelectors"; + +interface Config { + set: ( + payload: Partial, + ) => ReduxAction>; + get: (state: AppState) => CanvasDebuggerState; +} + +const canvasDebuggerConfig: Config = { + set: setCanvasDebuggerState, + get: getCanvasDebuggerState, +}; +const pluginActionEditorDebuggerConfig: Config = { + set: setPluginActionEditorDebuggerState, + get: getPluginActionDebuggerState, +}; + +export const getDebuggerPaneConfig = ( + focusInfo: FocusEntityInfo, + ideViewMode: EditorViewMode, +): Config => { + if (ideViewMode === EditorViewMode.SplitScreen) { + return canvasDebuggerConfig; + } + + switch (focusInfo.entity) { + case FocusEntity.QUERY: + return pluginActionEditorDebuggerConfig; + case FocusEntity.JS_OBJECT: + return { + set: setJsPaneDebuggerState, + get: getJsPaneDebuggerState, + }; + default: + return canvasDebuggerConfig; + } +}; diff --git a/app/client/src/sagas/DebuggerSagas.ts b/app/client/src/sagas/DebuggerSagas.ts index 6fe79e0dda18..5998de9cae5c 100644 --- a/app/client/src/sagas/DebuggerSagas.ts +++ b/app/client/src/sagas/DebuggerSagas.ts @@ -58,8 +58,8 @@ import { import { identifyEntityFromPath } from "../navigation/FocusEntity"; import { getIDEViewMode } from "../selectors/ideSelectors"; import type { EditorViewMode } from "IDE/Interfaces/EditorTypes"; -import { getDebuggerPaneConfig } from "../components/editorComponents/Debugger/hooks/useDebuggerConfig"; import { DEBUGGER_TAB_KEYS } from "../components/editorComponents/Debugger/constants"; +import { getDebuggerPaneConfig } from "../components/editorComponents/Debugger/utils/getDebuggerPaneConfig"; let blockedSource: string | null = null;