Skip to content

Commit 9e1010a

Browse files
authored
Preventing tabs storybook collapse behavior from having no items (#3745)
1 parent a47c268 commit 9e1010a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/@react-spectrum/tabs/stories/Tabs.stories.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -446,9 +446,11 @@ let DynamicTabs = (props: Omit<SpectrumTabsProps<DynamicTabItem>, 'children'>) =
446446
};
447447

448448
let removeTab = () => {
449-
let newTabs = [...tabs];
450-
newTabs.pop();
451-
setTabs(newTabs);
449+
if (tabs.length > 1) {
450+
let newTabs = [...tabs];
451+
newTabs.pop();
452+
setTabs(newTabs);
453+
}
452454
};
453455

454456
return (

0 commit comments

Comments
 (0)