mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-22 07:53:34 +01:00
chore: last tab gets focussed after closing a tab
This commit is contained in:
parent
3037c3564e
commit
29cd9e4607
@ -2,6 +2,7 @@ import produce from 'immer';
|
|||||||
import {nanoid} from 'nanoid';
|
import {nanoid} from 'nanoid';
|
||||||
import find from 'lodash/find';
|
import find from 'lodash/find';
|
||||||
import filter from 'lodash/filter';
|
import filter from 'lodash/filter';
|
||||||
|
import last from 'lodash/last';
|
||||||
import actions from './actions';
|
import actions from './actions';
|
||||||
import {
|
import {
|
||||||
flattenItems,
|
flattenItems,
|
||||||
@ -93,13 +94,13 @@ const reducer = (state, action) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
case actions.REQUEST_TAB_CLOSE: {
|
case actions.REQUEST_TAB_CLOSE: {
|
||||||
return produce(state, (draft) => {
|
return produce(state, (draft) => {
|
||||||
draft.requestTabs = filter(draft.requestTabs, (rt) => rt.id !== action.requestTab.id);
|
draft.requestTabs = filter(draft.requestTabs, (rt) => rt.id !== action.requestTab.id);
|
||||||
|
|
||||||
if(draft.requestTabs && draft.requestTabs.length) {
|
if(draft.requestTabs && draft.requestTabs.length) {
|
||||||
draft.activeRequestTabId = draft.requestTabs[0].id;
|
// todo: closing tab needs to focus on the right adjacent tab
|
||||||
|
draft.activeRequestTabId = last(draft.requestTabs).id;
|
||||||
} else {
|
} else {
|
||||||
draft.activeRequestTabId = null;
|
draft.activeRequestTabId = null;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user