Fix possible selection bug after closing tab
This commit is contained in:
parent
a89f7e8ec7
commit
a47d7e4d9c
1 changed files with 1 additions and 1 deletions
|
@ -63,7 +63,7 @@ const TabBar = forwardRef(function (props, ref) {
|
|||
var newTabs = [...tabs];
|
||||
newTabs.splice(index, 1);
|
||||
setTabs(newTabs);
|
||||
setSelectedIndex(selectedIndex - 1);
|
||||
setSelectedIndex(Math.min(selectedIndex, newTabs.length - 1));
|
||||
if (props.onTabClosed) {
|
||||
props.onTabClosed(index);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue