Explore: correctly cleanup state on unmount (#32557)

This commit is contained in:
Andrej Ocenas 2021-04-07 16:53:37 +02:00 committed by GitHub
parent 8e70d5d181
commit 0c2c52c627
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -184,6 +184,14 @@ export const exploreReducer = (state = initialExploreState, action: AnyAction):
if (cleanupPaneAction.match(action)) {
const { exploreId } = action.payload as CleanupPanePayload;
// We want to do this only when we remove single pane not when we are unmounting whole explore.
// It needs to be checked like this because in component we don't get new path (which would tell us if we are
// navigating out of explore) before the unmount.
if (!state[exploreId]?.initialized) {
return state;
}
if (exploreId === ExploreId.left) {
return {
...state,