fix(dashboard): properly unset mountedTab in reducer (#11558)

This commit is contained in:
David Aaron Suddjian 2020-11-04 14:27:32 -08:00 committed by GitHub
parent d999802795
commit ef7087adb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -124,13 +124,16 @@ export default function dashboardStateReducer(state = {}, action) {
}; };
}, },
[SET_DIRECT_PATH]() { [SET_DIRECT_PATH]() {
return { const newState = {
...state, ...state,
// change of direct path (tabs) will reset current mounted tab
mountedTab: null,
directPathToChild: action.path, directPathToChild: action.path,
directPathLastUpdated: Date.now(), directPathLastUpdated: Date.now(),
}; };
// change of direct path (tabs) will reset current mounted tab
// cannot just set mountedTab to null,
// as that is used when transitioning between tabs.
delete newState.mountedTab;
return newState;
}, },
[SET_MOUNTED_TAB]() { [SET_MOUNTED_TAB]() {
// set current mounted tab after tab is really mounted to DOM // set current mounted tab after tab is really mounted to DOM