fix(core-ui): CB-1826 default tab selection

This commit is contained in:
Wroud
2022-04-01 10:06:07 +03:00
parent c24b57eb86
commit cd83245ba9
@@ -98,7 +98,11 @@ export const TabsState = observer(function TabsState<T = Record<string, any>>({
const tabExists = displayed.some(tabInfo => tabInfo.key === dynamic.selectedId);
if (displayed.length && !tabExists) {
state.selectedId = selectedId;
if (displayed.some(tabInfo => tabInfo.key === selectedId)) {
state.selectedId = selectedId;
} else {
state.selectedId = displayed[0].key;
}
}
}