Skip to content

Commit

Permalink
Open debugger on load error
Browse files Browse the repository at this point in the history
  • Loading branch information
hetunandu committed Aug 26, 2024
1 parent 40a7619 commit b1bd60f
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions app/client/src/sagas/DebuggerSagas.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import type {
DeleteErrorLogPayload,
LogDebuggerErrorAnalyticsPayload,
import {
type DeleteErrorLogPayload,
type LogDebuggerErrorAnalyticsPayload,
setDebuggerSelectedTab,
showDebugger,
} from "actions/debuggerActions";
import {
addErrorLogs,
Expand Down Expand Up @@ -40,7 +42,10 @@ import type { JSCollection } from "entities/JSCollection";
import LOG_TYPE from "entities/AppsmithConsole/logtype";
import type { ConfigTree } from "entities/DataTree/dataTreeTypes";
import { getConfigTree } from "selectors/dataTreeSelectors";
import { createLogTitleString } from "components/editorComponents/Debugger/helpers";
import {
createLogTitleString,
DEBUGGER_TAB_KEYS,
} from "components/editorComponents/Debugger/helpers";
import AppsmithConsole from "utils/AppsmithConsole";
import { getWidget } from "./selectors";
import AnalyticsUtil, { AnalyticsEventType } from "ee/utils/AnalyticsUtil";
Expand All @@ -56,6 +61,7 @@ import {
transformAddErrorLogsSaga,
transformDeleteErrorLogsSaga,
} from "ee/sagas/helpers";
import { objectKeys } from "@appsmith/utils";

let blockedSource: string | null = null;

Expand Down Expand Up @@ -812,6 +818,17 @@ function* activeFieldDebuggerErrorHandler(
}
}

function* handleHideDebuggerSaga(action: ReduxAction<boolean>) {
const { payload } = action;
const currentDebuggerErrors: Record<string, Log> =
yield select(getDebuggerErrors);

if (objectKeys(currentDebuggerErrors).length && !payload) {
yield put(showDebugger());
yield put(setDebuggerSelectedTab(DEBUGGER_TAB_KEYS.ERROR_TAB));
}
}

export default function* debuggerSagasListeners() {
yield all([
takeEvery(ReduxActionTypes.DEBUGGER_LOG_INIT, debuggerLogSaga),
Expand All @@ -823,5 +840,6 @@ export default function* debuggerSagasListeners() {
ReduxActionTypes.DEBUGGER_DELETE_ERROR_LOG_INIT,
deleteDebuggerErrorLogsSaga,
),
takeEvery(ReduxActionTypes.HIDE_DEBUGGER_ERRORS, handleHideDebuggerSaga),
]);
}

0 comments on commit b1bd60f

Please sign in to comment.