From 28e3d0e21945a8e27dc6e7d183ad5a19162dd193 Mon Sep 17 00:00:00 2001 From: Jack Nam Date: Tue, 6 Aug 2024 17:13:39 -0700 Subject: [PATCH 1/2] Update SidebarLinksData.tsx --- src/pages/home/sidebar/SidebarLinksData.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/pages/home/sidebar/SidebarLinksData.tsx b/src/pages/home/sidebar/SidebarLinksData.tsx index b6d12320744..2010a41390d 100644 --- a/src/pages/home/sidebar/SidebarLinksData.tsx +++ b/src/pages/home/sidebar/SidebarLinksData.tsx @@ -39,8 +39,13 @@ function SidebarLinksData({insets, isLoadingApp = true, onLinkClick, priorityMod const {orderedReportIDs, currentReportID, policyMemberAccountIDs} = useReportIDs(); - // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps - useEffect(() => Policy.openWorkspace(activeWorkspaceID ?? '-1', policyMemberAccountIDs), [activeWorkspaceID]); + useEffect(() => { + if (!activeWorkspaceID || !policyMemberAccountIDs) { + return; + } + + Policy.openWorkspace(activeWorkspaceID, policyMemberAccountIDs); + }, [activeWorkspaceID, policyMemberAccountIDs]); const isLoading = isLoadingApp; const currentReportIDRef = useRef(currentReportID); From b3451be9cc69862861251f896b266aa879a6ee7c Mon Sep 17 00:00:00 2001 From: Jack Nam Date: Tue, 6 Aug 2024 17:34:44 -0700 Subject: [PATCH 2/2] Re-enable the lint disables --- src/pages/home/sidebar/SidebarLinksData.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pages/home/sidebar/SidebarLinksData.tsx b/src/pages/home/sidebar/SidebarLinksData.tsx index 2010a41390d..e5a74db796d 100644 --- a/src/pages/home/sidebar/SidebarLinksData.tsx +++ b/src/pages/home/sidebar/SidebarLinksData.tsx @@ -40,12 +40,13 @@ function SidebarLinksData({insets, isLoadingApp = true, onLinkClick, priorityMod const {orderedReportIDs, currentReportID, policyMemberAccountIDs} = useReportIDs(); useEffect(() => { - if (!activeWorkspaceID || !policyMemberAccountIDs) { + if (!activeWorkspaceID) { return; } Policy.openWorkspace(activeWorkspaceID, policyMemberAccountIDs); - }, [activeWorkspaceID, policyMemberAccountIDs]); + // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps + }, [activeWorkspaceID]); const isLoading = isLoadingApp; const currentReportIDRef = useRef(currentReportID);