diff --git a/src/pages/home/sidebar/SidebarLinksData.tsx b/src/pages/home/sidebar/SidebarLinksData.tsx index b6d123207440..2010a41390d6 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);