## Description > [!TIP] > _Add a TL;DR when the description is longer than 500 words or extremely technical (helps the content, marketing, and DevRel team)._ > > _Please also include relevant motivation and context. List any dependencies that are required for this change. Add links to Notion, Figma or any other documents that might be relevant to the PR._ Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.All" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/14401534892> > Commit: cad55550d2e517bec0031fe4043ec76cfb4d67e3 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=14401534892&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Fri, 11 Apr 2025 12:38:06 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Refactor** - Revamped the error reporting system across the platform with enhanced contextual logging for faster issue diagnosis. - **Chore** - Removed legacy error tracking integrations, streamlining overall error handling and system reliability. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
108 lines
3.0 KiB
TypeScript
108 lines
3.0 KiB
TypeScript
import type { DependencyMap } from "utils/DynamicBindingUtils";
|
|
import { call, fork, put, select, take } from "redux-saga/effects";
|
|
import {
|
|
getEvaluationInverseDependencyMap,
|
|
getDataTree,
|
|
} from "selectors/dataTreeSelectors";
|
|
import type { DataTree } from "entities/DataTree/dataTreeTypes";
|
|
import { getActions } from "ee/selectors/entitiesSelector";
|
|
import type {
|
|
ActionData,
|
|
ActionDataState,
|
|
} from "ee/reducers/entityReducers/actionsReducer";
|
|
import type { ReduxAction } from "actions/ReduxActionTypes";
|
|
import {
|
|
ReduxActionErrorTypes,
|
|
ReduxActionTypes,
|
|
} from "ee/constants/ReduxActionConstants";
|
|
import log from "loglevel";
|
|
import captureException from "instrumentation/sendFaroErrors";
|
|
import { findLoadingEntities } from "utils/WidgetLoadingStateUtils";
|
|
|
|
const actionExecutionRequestActions = [
|
|
ReduxActionTypes.EXECUTE_PLUGIN_ACTION_REQUEST,
|
|
ReduxActionTypes.RUN_ACTION_REQUEST,
|
|
];
|
|
|
|
const actionExecutionCompletionActions = [
|
|
ReduxActionTypes.EXECUTE_PLUGIN_ACTION_SUCCESS,
|
|
ReduxActionTypes.RUN_ACTION_SUCCESS,
|
|
ReduxActionErrorTypes.RUN_ACTION_ERROR,
|
|
ReduxActionErrorTypes.EXECUTE_PLUGIN_ACTION_ERROR,
|
|
];
|
|
|
|
const ACTION_EXECUTION_REDUX_ACTIONS = [
|
|
// Actions
|
|
...actionExecutionRequestActions,
|
|
...actionExecutionCompletionActions,
|
|
ReduxActionTypes.RUN_ACTION_CANCELLED,
|
|
|
|
// Widget evalution
|
|
ReduxActionTypes.SET_EVALUATED_TREE,
|
|
];
|
|
|
|
function* setWidgetsLoadingSaga(action: ReduxAction<unknown>) {
|
|
if (actionExecutionCompletionActions.includes(action.type)) {
|
|
// Ensure that data is already available in the dataTree and all
|
|
// dependent entities have been re-evaluated
|
|
yield take(ReduxActionTypes.SET_EVALUATED_TREE);
|
|
}
|
|
|
|
const actions: ActionDataState = yield select(getActions);
|
|
const isLoadingActions: string[] = actions
|
|
.filter((action: ActionData) => action.isLoading)
|
|
.map((action: ActionData) => action.config.name);
|
|
|
|
if (isLoadingActions.length === 0) {
|
|
yield put({
|
|
type: ReduxActionTypes.SET_LOADING_ENTITIES,
|
|
payload: new Set<string>(),
|
|
});
|
|
} else {
|
|
const inverseMap: DependencyMap = yield select(
|
|
getEvaluationInverseDependencyMap,
|
|
);
|
|
const dataTree: DataTree = yield select(getDataTree);
|
|
|
|
const loadingEntities = findLoadingEntities(
|
|
isLoadingActions,
|
|
dataTree,
|
|
inverseMap,
|
|
);
|
|
|
|
yield put({
|
|
type: ReduxActionTypes.SET_LOADING_ENTITIES,
|
|
payload: loadingEntities,
|
|
});
|
|
}
|
|
|
|
if (action.type !== ReduxActionTypes.SET_EVALUATED_TREE) {
|
|
yield put({
|
|
type: ReduxActionTypes.TRIGGER_EVAL,
|
|
});
|
|
}
|
|
}
|
|
|
|
function* actionExecutionChangeListenerSaga() {
|
|
while (true) {
|
|
const action: ReduxAction<unknown> = yield take(
|
|
ACTION_EXECUTION_REDUX_ACTIONS,
|
|
);
|
|
|
|
yield fork(setWidgetsLoadingSaga, action);
|
|
}
|
|
}
|
|
|
|
export default function* actionExecutionChangeListeners() {
|
|
yield take(ReduxActionTypes.START_EVALUATION);
|
|
|
|
while (true) {
|
|
try {
|
|
yield call(actionExecutionChangeListenerSaga);
|
|
} catch (e) {
|
|
log.error(e);
|
|
captureException(e, { errorName: "WidgetLoadingError" });
|
|
}
|
|
}
|
|
}
|