diff --git a/lib/experimental/Navigation/Tabs/index.tsx b/lib/experimental/Navigation/Tabs/index.tsx index 865e2c05..04099ce7 100644 --- a/lib/experimental/Navigation/Tabs/index.tsx +++ b/lib/experimental/Navigation/Tabs/index.tsx @@ -21,15 +21,15 @@ export const BaseTabs: React.FC = ({ tabs, secondary = false }) => { // is active without the index first, and then with the index. Otherwise, // we would incorrectly match the index tab as active, resulting in two tabs // being active at the same time. - const sortedTabs = tabs.sort((a, b) => (a.index ? 1 : b.index ? -1 : 0)) - const activeTabIndex = sortedTabs.findIndex((tab) => isActive(tab.href)) + const sortedTabs = [...tabs].sort((a, b) => (a.index ? 1 : b.index ? -1 : 0)) + const activeTab = sortedTabs.find((tab) => isActive(tab.href)) return ( {tabs.map(({ label, ...props }, index) => (