From 6682a36b8ab35355c6adfcdb0f3f7caf9d6c8d61 Mon Sep 17 00:00:00 2001 From: Andrej Ocenas Date: Wed, 4 Dec 2019 12:51:15 +0100 Subject: [PATCH] Explore: Fix reset reducer duplication (#20838) --- public/app/features/explore/state/reducers.ts | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/public/app/features/explore/state/reducers.ts b/public/app/features/explore/state/reducers.ts index 80aeaac6cf9..11f3eaa4e77 100644 --- a/public/app/features/explore/state/reducers.ts +++ b/public/app/features/explore/state/reducers.ts @@ -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) {