Skip to content

Commit 72ced67

Browse files
authored
Fixes changing projects not selecting a tab (wpilibsuite#372)
1 parent 6a48d51 commit 72ced67

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/reactComponents/Tabs.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,11 @@ export const Component = React.forwardRef<TabsRef, TabsProps>((props, ref): Reac
448448
setActiveKey(newActiveKey);
449449
} else if (props.tabList.length === 0) {
450450
setActiveKey('');
451+
} else if (activeKey === '' && props.tabList.length > 0) {
452+
// No active tab but tabs exist, activate the first tab
453+
setActiveKey(props.tabList[0].key);
451454
}
452-
}, [props.tabList.length]);
455+
}, [props.tabList, activeKey]);
453456

454457
return (
455458
<>

0 commit comments

Comments
 (0)