-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35841 from lukemorawski/20354-task_assignees_list…
…_refactor_2 20354 task assignees list refactor
- Loading branch information
Showing
5 changed files
with
123 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import {useMemo} from 'react'; | ||
import {usePersonalDetails, useSession} from '@components/OnyxProvider'; | ||
import CONST from '@src/CONST'; | ||
import type {PersonalDetails} from '@src/types/onyx'; | ||
|
||
type CurrentUserPersonalDetails = PersonalDetails | Record<string, never>; | ||
|
||
function useCurrentUserPersonalDetails() { | ||
const session = useSession(); | ||
const personalDetails = usePersonalDetails() ?? CONST.EMPTY_OBJECT; | ||
const accountID = session?.accountID ?? 0; | ||
const accountPersonalDetails = personalDetails?.[accountID]; | ||
const currentUserPersonalDetails: CurrentUserPersonalDetails = useMemo( | ||
() => (accountPersonalDetails ? {...accountPersonalDetails, accountID} : {}) as CurrentUserPersonalDetails, | ||
[accountPersonalDetails, accountID], | ||
); | ||
|
||
return currentUserPersonalDetails; | ||
} | ||
|
||
export default useCurrentUserPersonalDetails; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.