Skip to content

Commit de89479

Browse files
authored
Merge pull request #46930 from Expensify/jack-preventOpenWorkspacewith-1
Prevent calling OpenWorkspace with an empty policyID
2 parents 8c11aa4 + b3451be commit de89479

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/pages/home/sidebar/SidebarLinksData.tsx

+8-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,14 @@ function SidebarLinksData({insets, isLoadingApp = true, onLinkClick, priorityMod
3939

4040
const {orderedReportIDs, currentReportID, policyMemberAccountIDs} = useReportIDs();
4141

42-
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
43-
useEffect(() => Policy.openWorkspace(activeWorkspaceID ?? '-1', policyMemberAccountIDs), [activeWorkspaceID]);
42+
useEffect(() => {
43+
if (!activeWorkspaceID) {
44+
return;
45+
}
46+
47+
Policy.openWorkspace(activeWorkspaceID, policyMemberAccountIDs);
48+
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
49+
}, [activeWorkspaceID]);
4450

4551
const isLoading = isLoadingApp;
4652
const currentReportIDRef = useRef(currentReportID);

0 commit comments

Comments
 (0)