2023-08-01 04:02:41 +00:00
|
|
|
import { all, call, takeEvery } from "redux-saga/effects";
|
|
|
|
|
import type { ReduxAction } from "@appsmith/constants/ReduxActionConstants";
|
|
|
|
|
import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants";
|
|
|
|
|
import EntityNavigationFactory from "pages/Editor/EntityNavigation/factory";
|
|
|
|
|
import type { EntityInfo } from "pages/Editor/EntityNavigation/types";
|
|
|
|
|
import log from "loglevel";
|
2023-08-10 13:55:06 +00:00
|
|
|
import type PaneNavigation from "pages/Editor/EntityNavigation/PaneNavigation";
|
2023-08-01 04:02:41 +00:00
|
|
|
|
|
|
|
|
function* navigateEntitySaga(action: ReduxAction<EntityInfo>) {
|
|
|
|
|
try {
|
2023-08-10 13:55:06 +00:00
|
|
|
const paneNavigation: PaneNavigation = yield call(
|
|
|
|
|
EntityNavigationFactory.create,
|
|
|
|
|
action.payload,
|
|
|
|
|
);
|
2023-08-01 04:02:41 +00:00
|
|
|
yield call(paneNavigation.init);
|
|
|
|
|
yield call(paneNavigation.navigate);
|
|
|
|
|
} catch (e) {
|
|
|
|
|
log.error(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default function* navigationSagas() {
|
|
|
|
|
yield all([
|
|
|
|
|
takeEvery(ReduxActionTypes.NAVIGATE_TO_ENTITY, navigateEntitySaga),
|
|
|
|
|
]);
|
|
|
|
|
}
|