Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions src/ui/units/connections/components/Page/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import {
getConnectors,
setInitialState,
setPageData,
setRevision,
updateConnectionWithRevision,
} from '../../store';
import {getConnItemByType} from '../../utils';
Expand Down Expand Up @@ -191,13 +190,7 @@ const PageComponent = (props: PageProps) => {
workbookId,
rev_id: revId,
});
//This is initial request data, there is no need to request it when changing revId
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [actions, extractedEntryId, workbookId]);

React.useEffect(() => {
actions.setRevision(revId);
}, [revId, actions]);
}, [actions, extractedEntryId, workbookId, revId]);

const setActualVersion = React.useMemo(
() =>
Expand Down Expand Up @@ -305,7 +298,6 @@ const mapDispatchToProps = (dispatch: Dispatch) => {
openDialogErrorWithTabs,
openDialogSaveDraftChartAsActualConfirm,
updateConnectionWithRevision,
setRevision,
},
dispatch,
),
Expand Down
25 changes: 2 additions & 23 deletions src/ui/units/connections/store/actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ interface GetConnectionDataRequestProps {
flattenConnectors: ConnectorItem[];
rev_id?: string;
}
export async function getConnectionDataRequest({

async function getConnectionDataRequest({
entry,
flattenConnectors,
rev_id,
Expand All @@ -101,28 +102,6 @@ export async function getConnectionDataRequest({
return {connectionData, connectionError};
}

export function setRevision(revId?: string) {
return async (dispatch: ConnectionsReduxDispatch, getState: GetState) => {
const {
connections: {flattenConnectors, entry},
} = getState();
if (entry) {
dispatch(setPageLoading({pageLoading: true}));
const {connectionData, connectionError} = await getConnectionDataRequest({
entry,
flattenConnectors,
rev_id: revId,
});
batch(() => {
dispatch(
setConectorData({connectionData: connectionData ?? {}, error: connectionError}),
);
dispatch(setPageLoading({pageLoading: false}));
});
}
};
}

export function setPageData({
entryId,
workbookId,
Expand Down
Loading