From fad95a3bf0c7959b74d0fd5b7850414353d9514c Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Thu, 22 Feb 2024 13:06:52 +0800 Subject: [PATCH] get current user account id from currentUserPersonalDetails --- src/pages/home/sidebar/SidebarLinksData.js | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/pages/home/sidebar/SidebarLinksData.js b/src/pages/home/sidebar/SidebarLinksData.js index 828077097580..c172b07f3ab4 100644 --- a/src/pages/home/sidebar/SidebarLinksData.js +++ b/src/pages/home/sidebar/SidebarLinksData.js @@ -9,7 +9,7 @@ import _ from 'underscore'; import networkPropTypes from '@components/networkPropTypes'; import {withNetwork} from '@components/OnyxProvider'; import withCurrentReportID from '@components/withCurrentReportID'; -import withCurrentUserPersonalDetails from '@components/withCurrentUserPersonalDetails'; +import withCurrentUserPersonalDetails, {withCurrentUserPersonalDetailsDefaultProps, withCurrentUserPersonalDetailsPropTypes} from '@components/withCurrentUserPersonalDetails'; import withNavigationFocus from '@components/withNavigationFocus'; import useActiveWorkspace from '@hooks/useActiveWorkspace'; import useLocalize from '@hooks/useLocalize'; @@ -68,11 +68,6 @@ const propTypes = { // eslint-disable-next-line react/forbid-prop-types policyMembers: PropTypes.object, - /** Session info for the currently logged in user. */ - session: PropTypes.shape({ - /** Currently logged in user accountID */ - accountID: PropTypes.number, - }), /** All of the transaction violations */ transactionViolations: PropTypes.shape({ violations: PropTypes.arrayOf( @@ -97,6 +92,8 @@ const propTypes = { }), ), }), + + ...withCurrentUserPersonalDetailsPropTypes, }; const defaultProps = { @@ -106,11 +103,9 @@ const defaultProps = { betas: [], policies: {}, policyMembers: {}, - session: { - accountID: '', - }, transactionViolations: {}, allReportActions: {}, + ...withCurrentUserPersonalDetailsDefaultProps, }; function SidebarLinksData({ @@ -126,15 +121,15 @@ function SidebarLinksData({ priorityMode, network, policyMembers, - session: {accountID}, transactionViolations, + currentUserPersonalDetails, }) { const styles = useThemeStyles(); const {activeWorkspaceID} = useActiveWorkspace(); const {translate} = useLocalize(); const prevPriorityMode = usePrevious(priorityMode); - const policyMemberAccountIDs = getPolicyMembersByIdWithoutCurrentUser(policyMembers, activeWorkspaceID, accountID); + const policyMemberAccountIDs = getPolicyMembersByIdWithoutCurrentUser(policyMembers, activeWorkspaceID, currentUserPersonalDetails.accountID); // eslint-disable-next-line react-hooks/exhaustive-deps useEffect(() => Policy.openWorkspace(activeWorkspaceID, policyMemberAccountIDs), [activeWorkspaceID]);