Skip to content

Commit 26a9884

Browse files
committed
fix edge case with stale displayName
1 parent 0fc8cc7 commit 26a9884

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/pages/inbox/report/DelegateOnBehalfOfText.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ type DelegateOnBehalfOfTextProps = {
1919
function DelegateOnBehalfOfText({mainAccountID, fallbackLogin}: DelegateOnBehalfOfTextProps) {
2020
const styles = useThemeStyles();
2121
const {translate} = useLocalize();
22-
const [resolvedLogin] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {
23-
selector: (list: OnyxEntry<OnyxTypes.PersonalDetailsList>) => (mainAccountID ? list?.[mainAccountID]?.login : undefined),
22+
const [resolvedDetail] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {
23+
selector: (list: OnyxEntry<OnyxTypes.PersonalDetailsList>) => (mainAccountID ? list?.[mainAccountID] : undefined),
2424
});
25-
const mainAccountLogin = resolvedLogin ?? fallbackLogin;
25+
const mainAccountLogin = resolvedDetail?.login ?? fallbackLogin;
2626
const accountOwnerDetails = getPersonalDetailByEmail(String(mainAccountLogin ?? ''));
2727
return <Text style={[styles.chatDelegateMessage]}>{translate('delegate.onBehalfOfMessage', accountOwnerDetails?.displayName ?? '')}</Text>;
2828
}

0 commit comments

Comments
 (0)