Skip to content

Commit

Permalink
Fix policyMemberAccountIDs types
Browse files Browse the repository at this point in the history
  • Loading branch information
WojtekBoman committed Jan 18, 2024
1 parent 9de5686 commit fe330e8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/libs/Navigation/AppNavigator/ReportScreenIDSetter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ const getLastAccessedReportID = (
function ReportScreenIDSetter({route, reports, policies, policyMembers = {}, navigation, isFirstTimeNewExpensifyUser = false, reportMetadata}: ReportScreenIDSetterProps) {
const {canUseDefaultRooms} = usePermissions();
const {activeWorkspaceID} = useActiveWorkspace();


useEffect(() => {
// Don't update if there is a reportID in the params already
Expand All @@ -72,7 +71,9 @@ function ReportScreenIDSetter({route, reports, policies, policyMembers = {}, nav
return;
}

const policyMemberAccountIDs = policyMembers ? Object.keys(policyMembers[`${ONYXKEYS.COLLECTION.POLICY_MEMBERS}${activeWorkspaceID}`] ?? {}) : [];
const policyMemberAccountIDs = policyMembers
? Object.keys(policyMembers[`${ONYXKEYS.COLLECTION.POLICY_MEMBERS}${activeWorkspaceID}`] ?? {}).map((accountID) => Number(accountID))
: [];

// If there is no reportID in route, try to find last accessed and use it for setParams
const reportID = getLastAccessedReportID(
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/sidebar/SidebarLinksData.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function SidebarLinksData({isFocused, allReportActions, betas, chatReports, curr
const {activeWorkspaceID} = useActiveWorkspace();
const {translate} = useLocalize();

const policyMemberAccountIDs = _.keys(policyMembers[`${ONYXKEYS.COLLECTION.POLICY_MEMBERS}${activeWorkspaceID}`]);
const policyMemberAccountIDs = _.map(_.keys(policyMembers[`${ONYXKEYS.COLLECTION.POLICY_MEMBERS}${activeWorkspaceID}`]), (accountID) => Number(accountID));

useEffect(() => Policy.openWorkspace(activeWorkspaceID, policyMemberAccountIDs), [activeWorkspaceID]);

Check warning on line 78 in src/pages/home/sidebar/SidebarLinksData.js

View workflow job for this annotation

GitHub Actions / lint

React Hook useEffect has a missing dependency: 'policyMemberAccountIDs'. Either include it or remove the dependency array

Expand Down

0 comments on commit fe330e8

Please sign in to comment.