fix(ui): prevent infinite render loop in Tabs with routed tabs

When navigating to a URL that doesn't match any tab href, the Tabs
component would pass `selectedKey={null}` to React Aria's Tabs,
which triggers an infinite render loop.

This fix uses an empty string instead of null to indicate no
selection, which React Aria handles correctly.

Signed-off-by: Johan Persson <johanopersson@gmail.com>
This commit is contained in:
Johan Persson
2026-01-27 15:56:12 +01:00
parent 60c1af6a79
commit 092c453b06
2 changed files with 8 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/ui': patch
---
Fixed an infinite render loop in Tabs when navigating to a URL that doesn't match any tab href.
+3 -2
View File
@@ -135,9 +135,10 @@ export const Tabs = (props: TabsProps) => {
return undefined;
}
// Has routed tabs but none are active - controlled mode with no selection
// Has routed tabs but none are active - use empty string for no selection
// (React Aria has a bug with null that causes infinite loops)
if (activeTabs.size === 0) {
return null;
return '';
}
let selectedId: string | null = null;