Explore: Fix reset reducer duplication (#20838)

This commit is contained in:
Andrej Ocenas 2019-12-04 12:51:15 +01:00 committed by GitHub
parent 79c0fa4ca5
commit 6682a36b8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,7 +55,6 @@ import {
updateUIStateAction,
toggleLogLevelAction,
changeLoadingStateAction,
resetExploreAction,
queryStreamUpdatedAction,
QueryEndedPayload,
queryStoreSubscriptionAction,
@ -727,6 +726,11 @@ export const exploreReducer = (state = initialExploreState, action: HigherOrderA
}
case ActionTypes.ResetExplore: {
const leftState = state[ExploreId.left];
const rightState = state[ExploreId.right];
stopQueryState(leftState.querySubscription);
stopQueryState(rightState.querySubscription);
if (action.payload.force || !Number.isInteger(state.left.originPanelId)) {
return initialExploreState;
}
@ -758,19 +762,6 @@ export const exploreReducer = (state = initialExploreState, action: HigherOrderA
[ExploreId.right]: updateChildRefreshState(rightState, action.payload, ExploreId.right),
};
}
case resetExploreAction.type: {
const leftState = state[ExploreId.left];
const rightState = state[ExploreId.right];
stopQueryState(leftState.querySubscription);
stopQueryState(rightState.querySubscription);
return {
...state,
[ExploreId.left]: updateChildRefreshState(leftState, action.payload, ExploreId.left),
[ExploreId.right]: updateChildRefreshState(rightState, action.payload, ExploreId.right),
};
}
}
if (action.payload) {