fix(plugin-tools-panel): CB-2286 fix default selected tab

This commit is contained in:
Konstantin Vasilev
2022-08-15 11:44:20 +03:00
parent 57343149fa
commit e11a0deb25
2 changed files with 8 additions and 3 deletions
@@ -53,7 +53,7 @@ export const TabsState = observer(function TabsState<T = Record<string, any>>({
const props = rest as any as T;
if (
!selectedId
&& !currentTabId
&& currentTabId === undefined
&& container
) {
const displayed = container.getIdList(props);
@@ -88,7 +88,7 @@ export const TabsState = observer(function TabsState<T = Record<string, any>>({
tabList,
});
if (currentTabId) {
if (currentTabId !== undefined) {
state.selectedId = currentTabId;
dynamic.selectedId = currentTabId;
}
@@ -97,7 +97,12 @@ export const ToolsPanel = observer<Props>(function ToolsPanel({ container }) {
}
return styled(useStyles(tabStyle, formStyles))(
<TabsState currentTabId={state.selectedTabId} container={container} lazy onChange={handleTabChange}>
<TabsState
currentTabId={state.selectedTabId ?? undefined}
container={container}
lazy
onChange={handleTabChange}
>
<box>
<TabList style={tabStyle} />
<content-box>