From 0016b72b3707e266750f037adddc5f93f4791d2e Mon Sep 17 00:00:00 2001 From: James Wysynski Date: Mon, 4 Jul 2022 09:24:57 -0700 Subject: [PATCH] Add hasOwnProperty checks for child fields in Tabs Summary: Add hasOwnProperty checks for child props in Tabs. This prevents warning output when a prop doesn't exist. {F748481722} Reviewed By: mweststrate Differential Revision: D37520888 fbshipit-source-id: 3b0c9fb1e94e76ecb4eb52e97d2f3aa010cb60ce --- desktop/flipper-plugin/src/ui/Tabs.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/desktop/flipper-plugin/src/ui/Tabs.tsx b/desktop/flipper-plugin/src/ui/Tabs.tsx index 29f1be69c..c5a1c9d5a 100644 --- a/desktop/flipper-plugin/src/ui/Tabs.tsx +++ b/desktop/flipper-plugin/src/ui/Tabs.tsx @@ -30,9 +30,15 @@ export function Tabs({ return; } const tabKey = - (typeof child.props.tabKey === 'string' && child.props.tabKey) || - (typeof child.props.tab === 'string' && child.props.tab) || - (typeof child.props.key === 'string' && child.props.key) || + (child.hasOwnProperty('tabKey') && + typeof child.props.tabKey === 'string' && + child.props.tabKey) || + (child.hasOwnProperty('tab') && + typeof child.props.tab === 'string' && + child.props.tab) || + (child.hasOwnProperty('key') && + typeof child.props.key === 'string' && + child.props.key) || `tab_${idx}`; keys.push(tabKey); return {