Skip to content

Commit

Permalink
fix tab selection bug causing test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
chad1008 committed Oct 24, 2022
1 parent bfca89e commit de66efe
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/components/src/tab-panel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ export function TabPanel( {
const selectedId = `${ instanceId }-${ selectedTab?.name ?? 'none' }`;

useEffect( () => {
if ( ! selectedTab?.name ) {
if ( ! selectedTab?.name && tabs.length > 0 ) {
handleTabSelection( initialTabName || tabs[ 0 ].name );
setSelected(
initialTabName ||
( tabs.length > 0 ? tabs[ 0 ].name : undefined )
Expand Down

0 comments on commit de66efe

Please sign in to comment.