Default to first tab if active tab not available
Summary: This is only really an issue in theUIDebugger where we have a dynamic number of tabs. on some nodes you have 3 tabs, on others you have 2. if you select the 3rd tab and move to a node with 2 tabs nothing will be selected. With this fix we will fallback to the first tab Reviewed By: lblasa Differential Revision: D50595977 fbshipit-source-id: 25c36a5609f774c2d3fd650eb6520104864fbe95
This commit is contained in:
committed by
Facebook GitHub Bot
parent
184316545a
commit
1b0eb31bd9
@@ -59,7 +59,7 @@ export function Tabs({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<AntdTabs
|
<AntdTabs
|
||||||
activeKey={activeTab}
|
activeKey={keys.includes(activeTab ?? 'not-there') ? activeTab : keys[0]}
|
||||||
onChange={(key) => {
|
onChange={(key) => {
|
||||||
setActiveTab(key);
|
setActiveTab(key);
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in New Issue
Block a user