From 1acc828b973759ec7a6e515f6b06c60ef864714f Mon Sep 17 00:00:00 2001 From: Carlos Dario Almonte Date: Thu, 28 Sep 2023 08:53:04 -0400 Subject: [PATCH] fix: eslint rule no conditional hooks OptioRowLHN --- src/components/LHNOptionsList/OptionRowLHN.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/components/LHNOptionsList/OptionRowLHN.js b/src/components/LHNOptionsList/OptionRowLHN.js index af5b73421e7c..fb6fd59870a0 100644 --- a/src/components/LHNOptionsList/OptionRowLHN.js +++ b/src/components/LHNOptionsList/OptionRowLHN.js @@ -75,6 +75,15 @@ function OptionRowLHN(props) { const optionItem = props.optionItem; const [isContextMenuActive, setIsContextMenuActive] = useState(false); + useFocusEffect( + useCallback(() => { + isFocusedRef.current = true; + return () => { + isFocusedRef.current = false; + }; + }, []), + ); + if (!optionItem) { return null; } @@ -108,14 +117,6 @@ function OptionRowLHN(props) { const shouldShowGreenDotIndicator = !hasBrickError && (optionItem.isUnreadWithMention || optionItem.isWaitingForTaskCompleteFromAssignee || ReportUtils.isWaitingForIOUActionFromCurrentUser(optionItem)); - useFocusEffect( - useCallback(() => { - isFocusedRef.current = true; - return () => { - isFocusedRef.current = false; - }; - }, []), - ); /** * Show the ReportActionContextMenu modal popover. *