App icon indicating copy to clipboard operation
App copied to clipboard

[Due for payment 2026-12-04] [$250] Members - Display name opens not here page

Open applause-bot[bot] opened this issue 3 weeks ago • 95 comments

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: 9.5.33-0 Reproducible in staging?: Yes Reproducible in production?: No If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://github.com/Expensify/App/pull/105050 Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Mac 26.5 / Chrome App Component: Workspace Settings

Action Performed:

  1. Go to staging.new.expensify.com
  2. Create new account and create new workspace.
  3. Go to workspace settings > Members.
  4. Invite a non-existing user.
  5. Click on the invited user.
  6. Click Display name.

Expected Result:

Display name settings will open.

Actual Result:

Display name opens not here page.

Workaround:

Unknown

Platforms:

  • [ ] Android: App
  • [ ] Android: mWeb Chrome
  • [ ] iOS: App
  • [ ] iOS: mWeb Safari
  • [ ] iOS: mWeb Chrome
  • [x] Windows: Chrome
  • [x] MacOS: Chrome Safari

Screenshots/Videos

https://github.com/user-attachments/assets/f3b26b33-90d1-4ebc-9d89-b15fa4d8dc51

View all open jobs on GitHub

Applause Internal Information Exported by: Julia Ponikarchuk Bug ID: 7306615

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @sobitneupane

applause-bot[bot] avatar Nov 06 '26 09:11 applause-bot[bot]

While Applause doesn't embed attachments for this bug, here are the links for quick view: https://platform.applause.com/services/links/v1/external/f15d27a36e8027d6aacf7fdf05bd7728809e551178ee6ce9aa5f8595b129fc12

applause-bot[bot] avatar Nov 06 '26 09:11 applause-bot[bot]

You have been assigned to this deploy blocker because you recently merged this PR: https://github.com/Expensify/App/pull/105050

melvin-bot[bot] avatar Nov 06 '26 09:11 melvin-bot[bot]

@NikkiWines @sobitneupane you have been assigned to this deploy blocker because you reviewed the offending PR: https://github.com/Expensify/App/pull/105050

melvin-bot[bot] avatar Nov 06 '26 09:11 melvin-bot[bot]

💬 A slack conversation has been started in #expensify-open-source

melvin-bot[bot] avatar Nov 06 '26 09:11 melvin-bot[bot]

:wave: Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

github-actions[bot] avatar Nov 06 '26 09:11 github-actions[bot]

It's not a deploy blocker. It's reproducible in production as well.

https://github.com/user-attachments/assets/f7b597bc-753e-4603-a971-d627e8b6caa4

sobitneupane avatar Nov 06 '26 09:11 sobitneupane

Nice, thank you for checking

NikkiWines avatar Nov 06 '26 12:11 NikkiWines

@sobitneupane let's open this up for proposals as this is still something we should fix .

NikkiWines avatar Nov 09 '26 19:11 NikkiWines

Proposal

Please re-state the problem that we are trying to solve in this issue.

After inviting a user who doesn't have an account yet, opening that member's details and pressing Display name shows the "not here" page instead of the display name editor.

What is the root cause of that problem?

WorkspaceMemberDisplayNamePage looks the member up only by the accountID in the route, and blocks the page if that lookup doesn't produce a login that is in the workspace's employeeList:

https://github.com/Expensify/App/blob/bd0f96babf90aa16d61f528caa490ada78d8eeb9/src/pages/workspace/members/WorkspaceMemberDisplayNamePage.tsx#L40-L47

https://github.com/Expensify/App/blob/bd0f96babf90aa16d61f528caa490ada78d8eeb9/src/pages/workspace/members/WorkspaceMemberDisplayNamePage.tsx#L61

The route's accountID doesn't always have a personal details entry for an invited user who has no account yet. They are invited under an optimistic ID generated from their login, and that entry is deleted when the invite request succeeds, because the backend supplies the real ID:

https://github.com/Expensify/App/blob/bd0f96babf90aa16d61f528caa490ada78d8eeb9/src/libs/PersonalDetailsUtils.ts#L287-L291

A Member details page opened while the invite is in flight keeps the optimistic ID in its route. The members list also generates an ID from the login when a member's personal details aren't loaded:

https://github.com/Expensify/App/blob/bd0f96babf90aa16d61f528caa490ada78d8eeb9/src/hooks/useWorkspaceMembers.ts#L39-L43

Member details handles both cases by recovering the login from the policy and then reading the personal details by login, so it renders normally:

https://github.com/Expensify/App/blob/bd0f96babf90aa16d61f528caa490ada78d8eeb9/src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx#L155-L159

Because the member has no name yet, it also offers the Display name row:

https://github.com/Expensify/App/blob/bd0f96babf90aa16d61f528caa490ada78d8eeb9/src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx#L210-L211

The dynamic route then inherits the same accountID from Member details, but the editor added in #105050 has no such recovery. memberLogin is undefined, isPolicyMember is false, and shouldBeBlocked becomes true. The two pages disagree about the same member: one offers the editor and the other refuses to open it.

This also explains why the report involves a non-existing user. A user who already has a personal details entry is invited under their real ID, so their route still resolves.

What changes do you think we should make in order to solve the problem?

Make WorkspaceMemberDisplayNamePage resolve the member the same way as its entry screen, using the existing getMemberLoginByAccountID helper that WorkArrangementPage and WorkspaceMemberCustomFieldPage already use:

https://github.com/Expensify/App/blob/bd0f96babf90aa16d61f528caa490ada78d8eeb9/src/pages/workspace/members/WorkArrangementPage.tsx#L71-L73

  1. Keep reading the route's personal details entry, including its loading state, and take memberLogin from that entry's login, falling back to getMemberLoginByAccountID(policy, routeAccountID).
  2. Read the member's personal details with usePersonalDetailByLogin(memberLogin) and use them for hasDisplayNameSet and the values passed on submit.
  3. Pass the resolved ID (the personal details' accountID, falling back to the route's) to updatePolicyMemberDisplayName, so the optimistic name is written to the member's real personal details entry. Otherwise, the Member details page, which reads by login, wouldn't show the new name until the server responded.

The hasDisplayNameSet and isPolicyMember guards stay as they are, so a member who already has a name, or someone who isn't in the workspace, stays blocked.

We should also add a UI test that renders the page with a stale optimistic accountID and asserts that the form shows and that submitting updates the real account's entry.

Compare branch: https://github.com/Expensify/App/compare/main...wildan-m:App:wildan/106201-display-name-resolve-member-by-login?expand=1

What alternative solutions did you explore? (Optional)

Removing the isPolicyMember check would open the page, but submitting would still do nothing because the handler returns early when there is no login:

https://github.com/Expensify/App/blob/bd0f96babf90aa16d61f528caa490ada78d8eeb9/src/pages/workspace/members/WorkspaceMemberDisplayNamePage.tsx#L82-L84

Hiding the Display name row when the route's ID has no personal details entry would avoid the error page, but a page opened with a stale route would never offer the row, so the admin couldn't set the name without reopening the member.

wildan-m avatar Nov 09 '26 19:11 wildan-m

Job added to Upwork: https://www.upwork.com/jobs/~022119882192113069189

melvin-bot[bot] avatar Nov 09 '26 19:11 melvin-bot[bot]

🤖 ProposalPolice™ is tracking duplicate proposals for this issue using an OpenAI Conversation. This comment stores that Conversation's ID and can be safely ignored.

github-actions[bot] avatar Nov 09 '26 19:11 github-actions[bot]

Proposal

What is the root cause of that problem?

After inviting someone without an account and opening their member details, pressing Display name shows the "not here" page. The editor never loads.

WorkspaceMemberDisplayNamePage takes the accountID from the route and reads personal details by that ID. It only treats the user as a member if that lookup yields a login found in the workspace employeeList:

https://github.com/Expensify/App/blob/bd0f96babf90aa16d61f528caa490ada78d8eeb9/src/pages/workspace/members/WorkspaceMemberDisplayNamePage.tsx#L40-L47

https://github.com/Expensify/App/blob/bd0f96babf90aa16d61f528caa490ada78d8eeb9/src/pages/workspace/members/WorkspaceMemberDisplayNamePage.tsx#L61

An invited user with no account can have a route accountID that has no personal details entry. The members list builds that ID from the login when the details aren't loaded:

https://github.com/Expensify/App/blob/bd0f96babf90aa16d61f528caa490ada78d8eeb9/src/hooks/useWorkspaceMembers.ts#L39-L43

When the lookup comes back empty, memberLogin is undefined, isPolicyMember is false and the page is blocked. The Member details page does not have this problem because it recovers the login from the policy first:

https://github.com/Expensify/App/blob/bd0f96babf90aa16d61f528caa490ada78d8eeb9/src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx#L155-L159

So Member details shows the Display name row, but the page behind it rejects the same member.

What changes do you think we should make in order to solve the problem?

  1. In WorkspaceMemberDisplayNamePage.tsx (the component body), make the workspace the source of truth for who the member is. Replace the login taken from route personal details with the existing getMemberLoginByAccountID helper, which WorkArrangementPage.tsx already uses:

https://github.com/Expensify/App/blob/bd0f96babf90aa16d61f528caa490ada78d8eeb9/src/pages/workspace/members/WorkArrangementPage.tsx#L71-L73

const memberLogin = getMemberLoginByAccountID(policy, accountID);
const memberDetails = usePersonalDetailByLogin(memberLogin);

Today isPolicyMember depends on a personal details entry that may not exist. With this change it depends only on employeeList, so the invited member passes the guard.

  1. In the same file, compute hasDisplayNameSet from memberDetails instead of the route-ID entry. The existing blocks for a member who already has a name, or for a non-member, stay as they are.

  2. In submit, use memberLogin and memberDetails?.accountID ?? accountID when calling updatePolicyMemberDisplayName. The early return at the linked lines then no longer fires for this member:

https://github.com/Expensify/App/blob/bd0f96babf90aa16d61f528caa490ada78d8eeb9/src/pages/workspace/members/WorkspaceMemberDisplayNamePage.tsx#L82-L84

What alternative solutions did you explore? (Optional)

Hiding the Display name row on Member details when the route ID has no personal details would avoid the error page. It would also remove the only way to set the name for that member, so the root cause would remain.

Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

samranahm avatar Nov 09 '26 19:11 samranahm

Proposal

What is the root cause of that problem?

The display-name page assumes the route’s accountID always identifies a current personal-details entry. It derives memberLogin only from that entry, then blocks the page when the login is missing.

https://github.com/Expensify/App/blob/eac6e9c188d4b8fceffa9531c6e4f17f3bf22438/src/pages/workspace/members/WorkspaceMemberDisplayNamePage.tsx#L40-L47

https://github.com/Expensify/App/blob/eac6e9c188d4b8fceffa9531c6e4f17f3bf22438/src/pages/workspace/members/WorkspaceMemberDisplayNamePage.tsx#L55-L62

That assumption is wrong for a newly invited user. When personal details are unavailable, the members list creates a temporary account ID from the login.

https://github.com/Expensify/App/blob/eac6e9c188d4b8fceffa9531c6e4f17f3bf22438/src/hooks/useWorkspaceMembers.ts#L39-L48

The member-details page already handles that temporary or stale ID. It recovers the login from policy.employeeList, reads personal details by login, and replaces the route ID with the real account ID when available.

https://github.com/Expensify/App/blob/eac6e9c188d4b8fceffa9531c6e4f17f3bf22438/src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx#L152-L161

The helper also covers invitations sent to a secondary login by consulting primaryLoginsInvited.

https://github.com/Expensify/App/blob/eac6e9c188d4b8fceffa9531c6e4f17f3bf22438/src/libs/WorkArrangementUtils.ts#L23-L35

Git history shows the display-name editor retained its direct personal-details lookup when it was moved under Member details, while Member details had already gained this recovery logic. Consequently, Member details can resolve the invite and offer the Display name row, but the child editor evaluates the same route ID as a non-member and opens the not-found page.

What changes do you think we should make in order to solve the problem?

I think we should make WorkspaceMemberDisplayNamePage resolve the member in the same way as WorkspaceMemberDetailsPage:

- const accountID = Number(route.params.accountID);
- const memberLogin = memberPersonalDetails?.login;
+ const routeAccountID = Number(route.params.accountID);
+ const memberLogin = routePersonalDetails?.login ?? getMemberLoginByAccountID(policy, routeAccountID);
+ const memberPersonalDetails = usePersonalDetailByLogin(memberLogin);
+ const accountID = memberPersonalDetails?.accountID ?? routeAccountID;

The page should keep the loading state from the route-ID lookup, use the login-resolved details for hasDisplayNameSet and rollback values, and pass the resolved accountID to updatePolicyMemberDisplayName. That last part ensures the optimistic name update is written to the real personal-details entry instead of an obsolete generated key.

The existing checks for workspace membership, admin access, and an already-set name remain unchanged. Existing members still resolve directly by route ID, while generated IDs, completed invitations, and secondary-login invitations use the fallback. I would add a UI test where the route contains a generated account ID but personal details contain the real ID, then verify that the form opens and submission updates the real entry.

What alternative solutions did you explore? (Optional)

I considered removing the isPolicyMember guard. That would expose the form, but submission still returns immediately when memberLogin is missing.

https://github.com/Expensify/App/blob/eac6e9c188d4b8fceffa9531c6e4f17f3bf22438/src/pages/workspace/members/WorkspaceMemberDisplayNamePage.tsx#L81-L94

Hiding the Display name row for unresolved route IDs would avoid the error page but would remove a valid action from newly invited members instead of fixing the inconsistent identity resolution.

mukhrr avatar Nov 09 '26 19:11 mukhrr

🚨 Edited by proposal-police: This proposal was edited at 2026-11-09 20:49:21 UTC.

Proposal (updated)

Please re-state the problem that we are trying to solve in this issue.

After inviting a user who has no Expensify account, opening that member's details and pressing Display name shows the "not here" page instead of the display name editor.

What is the root cause of that problem?

When we invite someone who has no account yet, the app gives them a temporary accountID made from their email (generateAccountID(email)). When the invite finishes, that temporary personal details entry is removed, and the backend sends the member's details under their real accountID:

https://github.com/Expensify/App/blob/b0ed611f12b4aa4473b8c5fe3de1444f35947f1e/src/libs/PersonalDetailsUtils.ts#L286-L296

If Member details was opened before the invite finished, its route keeps the temporary accountID. The members list also builds an accountID from the email when a member has no personal details:

https://github.com/Expensify/App/blob/b0ed611f12b4aa4473b8c5fe3de1444f35947f1e/src/hooks/useWorkspaceMembers.ts#L43

Member details handles that ID: it gets the login from the policy, then reads the personal details by login, so it shows the member and offers the Display name row:

https://github.com/Expensify/App/blob/b0ed611f12b4aa4473b8c5fe3de1444f35947f1e/src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx#L153-L156

The Display name page doesn't. It reads personal details only by the route accountID, which no longer has an entry, so memberLogin is undefined, isPolicyMember is false, and the page is blocked:

https://github.com/Expensify/App/blob/b0ed611f12b4aa4473b8c5fe3de1444f35947f1e/src/pages/workspace/members/WorkspaceMemberDisplayNamePage.tsx#L40-L47

https://github.com/Expensify/App/blob/b0ed611f12b4aa4473b8c5fe3de1444f35947f1e/src/pages/workspace/members/WorkspaceMemberDisplayNamePage.tsx#L61

What changes do you think we should make in order to solve the problem?

In WorkspaceMemberDisplayNamePage, resolve the member exactly like WorkspaceMemberDetailsPage does:

const routeAccountID = Number(route.params.accountID);
const [routePersonalDetails, routePersonalDetailsResult] = usePersonalDetail(routeAccountID);
const memberLogin = routePersonalDetails?.login ?? getMemberLoginByAccountID(policy, routeAccountID);
const memberPersonalDetails = usePersonalDetailByLogin(memberLogin);
const accountID = memberPersonalDetails?.accountID ?? routeAccountID;

Keep the loading state on the route lookup. hasDisplayNameSet and the values passed on submit then come from the real entry, and updatePolicyMemberDisplayName writes the optimistic name to the real accountID.

Only falling back for memberLogin (my earlier version) is not enough. I tested it and found two problems:

  1. The save writes the optimistic name to the old temporary accountID, so Member details (which reads by login) doesn't show the new name until the server responds.
  2. hasDisplayNameSet still reads the empty temporary entry, so the editor opens even for a member whose real entry already has a name. That skips the "admins can only set a name the member hasn't set" rule.

Reading by login fixes both.

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

Add tests/ui/WorkspaceMemberDisplayNamePageTest.tsx:

  1. The route holds the temporary accountID and the real entry is under another ID → the editor opens and saving targets the real accountID.
  2. The member has no personal details at all → the editor opens and saving uses the route accountID.
  3. Normal member opened by their real accountID → the editor opens (no regression).
  4. Temporary accountID, but the real entry already has a name → still blocked.
  5. accountID that doesn't belong to a workspace member → still blocked.

On main, cases 1 and 2 fail. With only the memberLogin fallback, cases 1 and 4 fail. With the full fix, all 5 pass.

Test Branch

Code Difference: https://github.com/Expensify/App/compare/main...abbasifaizan70:Expensify:106201?expand=1 Test Branch: https://github.com/abbasifaizan70/Expensify/tree/106201

Demos

Before

https://github.com/user-attachments/assets/26d4f7c9-65cf-4bb3-9cbe-a0328b4e83c9

After

https://github.com/user-attachments/assets/db4ac7c6-5078-4563-b769-5edbc526b177

abbasifaizan70 avatar Nov 09 '26 20:11 abbasifaizan70

Proposal updated — added compare branch with implementation.

wildan-m avatar Nov 09 '26 20:11 wildan-m

Withdrawn — I'm withdrawing this proposal so I only hold one job at a time, per the contributor guidelines. Thank you for reviewing.

Original proposal

Proposal

Please re-state the problem that we are trying to solve in this issue.

When inviting a non-existing user (a user who does not have an Expensify account yet) to a workspace, navigating to Workspace Settings > Members, selecting the invited user, and clicking on "Display name" opens the "Not here" (404/NotFound) page instead of the display name edit form.

What is the root cause of that problem?

In src/pages/workspace/members/WorkspaceMemberDisplayNamePage.tsx:

  1. The page extracts accountID from route.params.accountID and fetches personal details using usePersonalDetail(accountID).
  2. For an invited user who has not yet registered an Expensify account, useWorkspaceMembers (src/hooks/useWorkspaceMembers.ts) generates an optimistic client-side account ID using generateAccountID(login) (src/libs/UserUtils.ts).
  3. Because this newly invited user does not yet have a record in Onyx under personalDetailsList, usePersonalDetail(accountID) returns undefined.
  4. memberLogin is derived solely from memberPersonalDetails?.login (src/pages/workspace/members/WorkspaceMemberDisplayNamePage.tsx line 44), which evaluates to undefined.
  5. Because memberLogin is undefined, isPolicyMember = !!memberLogin && !!policy?.employeeList?.[memberLogin] evaluates to false.
  6. AccessOrNotFoundWrapper computes:
    shouldBeBlocked={!isLoadingMemberPersonalDetails && !hasSubmitted && (hasDisplayNameSet || !isPolicyMember)}
    
    Since !isPolicyMember is true, shouldBeBlocked evaluates to true, causing AccessOrNotFoundWrapper to block the screen and render NotFoundPage ("Not here" page).
  7. Additionally, onSubmit has an early return guard if (!memberLogin) return;, meaning even if the wrapper were not blocked, the form submission would silently abort without resolving memberLogin.

What changes do you think we should make in order to solve the problem?

In src/pages/workspace/members/WorkspaceMemberDisplayNamePage.tsx:

  1. Import generateAccountID from src/libs/UserUtils and getPersonalDetailByEmail from src/libs/PersonalDetailsUtils.
  2. Fall back to finding the member's login from policy?.employeeList if memberPersonalDetails?.login is not found, checking both generateAccountID(login) === accountID and getPersonalDetailByEmail(login)?.accountID === accountID.
  3. Resolve personalDetails using memberPersonalDetails ?? (memberLogin ? getPersonalDetailByEmail(memberLogin) : undefined) so that hasDisplayNameSet and the updatePolicyMemberDisplayName call inside onSubmit receive accurate personal detail fields and account IDs.
--- a/src/pages/workspace/members/WorkspaceMemberDisplayNamePage.tsx
+++ b/src/pages/workspace/members/WorkspaceMemberDisplayNamePage.tsx
@@ -13,6 +13,8 @@ import useThemeStyles from '@hooks/useThemeStyles';
 import Navigation from '@libs/Navigation/Navigation';
 import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
 import type {SettingsNavigatorParamList} from '@libs/Navigation/types';
+import {getPersonalDetailByEmail} from '@libs/PersonalDetailsUtils';
+import {generateAccountID} from '@libs/UserUtils';
 import {getDisplayNameErrors} from '@libs/ValidationUtils';
 
 import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper';
@@ -25,7 +27,7 @@ import CONST from '@src/CONST';
 import ONYXKEYS from '@src/ONYXKEYS';
 import {DYNAMIC_ROUTES} from '@src/ROUTES';
 import type SCREENS from '@src/SCREENS';
 import INPUT_IDS from '@src/types/form/DisplayNameForm';
 import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue';
 
-import React, {useState} from 'react';
+import React, {useMemo, useState} from 'react';
 import {View} from 'react-native';
 
 type WorkspaceMemberDisplayNamePageProps = PlatformStackScreenProps<SettingsNavigatorParamList, typeof SCREENS.WORKSPACE.DYNAMIC_MEMBER_DISPLAY_NAME>;
@@ -41,9 +43,18 @@ function WorkspaceMemberDisplayNamePage({route}: WorkspaceMemberDisplayNamePage
     const accountID = Number(route.params.accountID);
     const policyID = route.params.policyID;
     const [memberPersonalDetails, memberPersonalDetailsResult] = usePersonalDetail(accountID);
     const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`);
-    const memberLogin = memberPersonalDetails?.login;
+    const memberLogin = useMemo(() => {
+        if (memberPersonalDetails?.login) {
+            return memberPersonalDetails.login;
+        }
+        return Object.keys(policy?.employeeList ?? {}).find((login) => {
+            return generateAccountID(login) === accountID || getPersonalDetailByEmail(login)?.accountID === accountID;
+        });
+    }, [accountID, memberPersonalDetails?.login, policy?.employeeList]);
+    const personalDetails = memberPersonalDetails ?? (memberLogin ? getPersonalDetailByEmail(memberLogin) : undefined);
     const isLoadingMemberPersonalDetails = isLoadingOnyxValue(memberPersonalDetailsResult);
-    const hasDisplayNameSet = !!memberPersonalDetails?.firstName || !!memberPersonalDetails?.lastName;
+    const hasDisplayNameSet = !!personalDetails?.firstName || !!personalDetails?.lastName;
     const isPolicyMember = !!memberLogin && !!policy?.employeeList?.[memberLogin];
     const backPath = useDynamicBackPath(DYNAMIC_ROUTES.WORKSPACE_MEMBER_DISPLAY_NAME.path);
 
@@ -84,10 +95,10 @@ function WorkspaceMemberDisplayNamePage({route}: WorkspaceMemberDisplayNamePage
                             setHasSubmitted(true);
                             updatePolicyMemberDisplayName(policyID, values.firstName.trim(), values.lastName.trim(), formatPhoneNumber, {
-                                accountID,
+                                accountID: personalDetails?.accountID ?? accountID,
                                 email: memberLogin,
-                                firstName: memberPersonalDetails?.firstName,
-                                lastName: memberPersonalDetails?.lastName,
-                                displayName: memberPersonalDetails?.displayName,
-                                avatar: memberPersonalDetails?.avatar,
+                                firstName: personalDetails?.firstName,
+                                lastName: personalDetails?.lastName,
+                                displayName: personalDetails?.displayName,
+                                avatar: personalDetails?.avatar,
                             });
                             Navigation.goBack();

What alternative solutions did you explore? (Optional)

  • Passing email / login in route parameters (DYNAMIC_ROUTES.WORKSPACE_MEMBER_DISPLAY_NAME): We explored passing login in the route parameters alongside accountID. However, this would require modifying route patterns, navigation types, and existing callers in WorkspaceMemberDetailsPage, which is unnecessary when policy.employeeList is already subscribed in Onyx on this page.
  • Forcing route ID replacement via navigation parameters in WorkspaceMemberDetailsPage: For users who have not registered an account yet, there is no backend personal detail entry or persistent account ID to replace the route param with; the optimistic ID generated from generateAccountID(login) remains the valid client identifier. Handling the resolution within WorkspaceMemberDisplayNamePage ensures self-contained reliability.

Differentiators from competitor proposals:

  • Competitor proposals only focus on satisfying isPolicyMember to bypass shouldBeBlocked, overlooking that onSubmit also depends on memberLogin and personalDetails for updatePolicyMemberDisplayName.
  • Our proposal resolves both memberLogin and personalDetails consistently, ensuring hasDisplayNameSet, form validation, and updatePolicyMemberDisplayName payload construction remain regression-free under offline and optimistic invite states.

Burapa-J avatar Nov 09 '26 20:11 Burapa-J

Proposal

What is the root cause of that problem?

Inviting someone who has no account yet leaves the workspace with an employee entry but no personal details for them, so the members list routes with an accountID it generates from the login instead of a real one:

https://github.com/Expensify/App/blob/eac6e9c188d4b8fceffa9531c6e4f17f3bf22438/src/hooks/useWorkspaceMembers.ts#L39-L48

WorkspaceMemberDisplayNamePage reads the member only through that accountID, and takes the login straight off the personal details entry:

https://github.com/Expensify/App/blob/eac6e9c188d4b8fceffa9531c6e4f17f3bf22438/src/pages/workspace/members/WorkspaceMemberDisplayNamePage.tsx#L40-L47

For a generated accountID there is no personal details entry, so memberLogin is undefined, isPolicyMember is false, and the page blocks itself:

https://github.com/Expensify/App/blob/eac6e9c188d4b8fceffa9531c6e4f17f3bf22438/src/pages/workspace/members/WorkspaceMemberDisplayNamePage.tsx#L55-L62

The row that leads here is shown on a different condition, !hasDisplayNameSet && isPolicyAdmin(...), which has nothing to say about personal details, so an admin sees a Display name row that always lands on the not here page for an invited user who has not signed up yet.

The sibling page already handles this exact case. WorkspaceMemberDetailsPage falls back to resolving the login from the policy when personal details are missing, which is why member details opens fine and only Display name fails:

https://github.com/Expensify/App/blob/eac6e9c188d4b8fceffa9531c6e4f17f3bf22438/src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx#L153

and the helper it uses exists specifically for optimistic invite IDs:

https://github.com/Expensify/App/blob/eac6e9c188d4b8fceffa9531c6e4f17f3bf22438/src/libs/WorkArrangementUtils.ts#L23-L34

#105050 moved this page from the profile navigator to the workspace one and switched it to route.params.accountID, but it did not pick up that fallback, so the page kept the assumption that a route accountID always resolves to personal details.

I confirmed this on main at eac6e9c by rendering WorkspaceMemberDisplayNamePage with the state an invite leaves behind: the invited email present in policy.employeeList, no personal details entry, and the route carrying generateAccountID(email). The page does not render, which is the not here page. Rendering the identical case with personal details present under a real accountID does render the editor, which isolates the missing personal details as the cause rather than anything about the route or the policy.

Reproduction

Driven against a local build of main at eac6e9c, seeded with the Onyx state an invite to a user with no account leaves behind: the invited email in policy.employeeList, no personal details entry for them, and the route carrying generateAccountID(email), which is the ID the members list falls back to. Same workspace, same member and same route in both clips.

Before, the Display name row opens the not here page:

https://github.com/user-attachments/assets/c1085e7e-0180-4185-8161-08a1b97df515

After the change, the same route opens the editor:

https://github.com/user-attachments/assets/bef6cb4b-4e22-4c13-9f4a-b27566f77f75

What changes do you think we should make in order to solve the problem?

Give the page the same fallback the member details page already uses, in src/pages/workspace/members/WorkspaceMemberDisplayNamePage.tsx:

import {getMemberLoginByAccountID} from '@libs/WorkArrangementUtils';

const memberLogin = memberPersonalDetails?.login ?? getMemberLoginByAccountID(policy, accountID);

Nothing else needs to change. isPolicyMember then resolves through policy.employeeList for an invited member, the page stops blocking, and hasDisplayNameSet stays false for someone with no details so the editor opens empty, which is the point of the flow. getMemberLoginByAccountID also covers invited secondary logins through primaryLoginsInvited and phone logins through Str.removeSMSDomain, so those invite shapes resolve too rather than needing their own handling.

Using the existing helper keeps the two pages reading the member the same way. If they keep resolving it differently, the Display name row can go on pointing at a page that disagrees with the one that rendered it.

For tests, a UI test alongside the ones #105050 added in tests/ui/WorkspaceMemberDetailsPageTest.tsx: render the display name page with the invited email in employeeList, no personal details, and generateAccountID(email) in the route, and assert the editor renders. With the change above that passes, and the existing 69 tests in WorkspaceMemberDetailsPageTest.tsx and getPathWithoutDynamicSuffixTests.ts still pass.


Update. @abbasifaizan70 is right that the one line memberLogin fallback is not enough, and I checked it rather than take it on trust. Reverting to just that line, my case for a member who already has a name fails: the route keeps the temporary accountID, so hasDisplayNameSet reads nothing and the editor opens for someone it should refuse. The save has the same shape, since updatePolicyMemberDisplayName is handed the route accountID.

So the fix needs all three lines the member details page uses, not only the first:

import usePersonalDetailByLogin from '@hooks/usePersonalDetailByLogin';
import {getMemberLoginByAccountID} from '@libs/WorkArrangementUtils';

const routeAccountID = Number(route.params.accountID);
const memberLogin = routePersonalDetails?.login ?? getMemberLoginByAccountID(policy, routeAccountID);
const memberPersonalDetails = usePersonalDetailByLogin(memberLogin);
const accountID = memberPersonalDetails?.accountID ?? routeAccountID;

Resolving the login is only the first step. Re-reading the details by login is what makes hasDisplayNameSet see the real record, and taking accountID from those details is what makes the save land on the real account instead of the temporary one. That is exactly what https://github.com/Expensify/App/blob/eac6e9c188d4b8fceffa9531c6e4f17f3bf22438/src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx#L153 does, which is the pattern this page should have inherited in #105050.

Verified on main at eac6e9c with four cases: invited member with no details opens the editor, a member with details still opens it, a member who already has a name under a real accountID stays blocked, and the resolved member is the real one so the save targets the real accountID. With the one line version the third case fails. With the three lines above all four pass, and the existing 69 tests in WorkspaceMemberDetailsPageTest.tsx and getPathWithoutDynamicSuffixTests.ts still pass.

What alternative solutions did you explore?

Passing the login through the route, the way the members list already does for the profile page when details are missing. It works, but it widens the dynamic route params for one page and leaves the page unable to cope if it is ever reached by a deep link or a refresh that carries only the accountID, which is the case this bug is about.

I also looked at relaxing the block to accept any accountID present in the policy. That removes the symptom but drops the guard that keeps the editor from opening for someone who is not a member of this workspace, so resolving the login properly seemed better than weakening the check.

preston-56 avatar Nov 09 '26 20:11 preston-56

Proposal

Please re-state the problem that we are trying to solve in this issue.

After inviting someone who doesn't have an Expensify account, opening that member and pressing Display name shows the "not here" page instead of the name form.

What is the root cause of that problem?

WorkspaceMemberDisplayNamePage only knows who the member is from the personal details of the route accountID:

https://github.com/Expensify/App/blob/9d34fd8dc512cb094aceb20348e1e28bf79ca3b1/src/pages/workspace/members/WorkspaceMemberDisplayNamePage.tsx#L42-L47

A newly invited user has no personal details entry for that ID: when details are missing, the members list builds the ID from the email with generateAccountID:

https://github.com/Expensify/App/blob/9d34fd8dc512cb094aceb20348e1e28bf79ca3b1/src/hooks/useWorkspaceMembers.ts#L43

So memberLogin is undefined, isPolicyMember is false, and the page is blocked:

https://github.com/Expensify/App/blob/9d34fd8dc512cb094aceb20348e1e28bf79ca3b1/src/pages/workspace/members/WorkspaceMemberDisplayNamePage.tsx#L61

The other member pages handle this case. Member details, WorkArrangementPage and WorkspaceMemberCustomFieldPage use the personal details first and fall back to getMemberLoginByAccountID when they're empty:

https://github.com/Expensify/App/blob/9d34fd8dc512cb094aceb20348e1e28bf79ca3b1/src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx#L153

The Display name page is the only one without that fallback.

What changes do you think we should make in order to solve the problem?

In WorkspaceMemberDisplayNamePage:

  1. Resolve the login the same way the other member pages do: memberLogin = memberPersonalDetails?.login ?? getMemberLoginByAccountID(policy, accountID)
    • The personal details lookup must stay first. getMemberLoginByAccountID only matches IDs generated from the email, so on its own it would miss members whose real accountID is known (e.g. an existing user with no name set) and block them:

https://github.com/Expensify/App/blob/9d34fd8dc512cb094aceb20348e1e28bf79ca3b1/src/libs/WorkArrangementUtils.ts#L28-L35

  1. Read the member's details by login with usePersonalDetailByLogin(memberLogin), as Member details does. Use them for hasDisplayNameSet and for the data passed to updatePolicyMemberDisplayName, with accountID: memberDetails?.accountID ?? accountID.
  2. Add WorkspaceMemberDisplayNamePageTest covering:
    • an invited user with no personal details: the form opens;
    • a member with a real accountID and no name: the form opens;
    • a member who already has a name, or a non-member: still blocked.

This differs from the earlier proposal, which replaces the personal details lookup with the helper. That would fix invited users but block members whose real accountID is known.

What alternative solutions did you explore? (Optional)

  • Hiding the Display name row when the member has no personal details: rejected. It removes the only way to name an invited member.
  • Creating personal details for invited users in useWorkspaceMembers: rejected. It's a bigger change to shared data for a problem one page's lookup can solve.

Jaweria-B avatar Nov 09 '26 20:11 Jaweria-B

📣 @wesomitsu! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details. Screen Shot 2022-11-16 at 4 42 54 PM Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

melvin-bot[bot] avatar Nov 09 '26 20:11 melvin-bot[bot]

Proposal

Please re-state the problem that we are trying to solve in this issue.

After inviting a new user, opening their Member details and pressing Display name sometimes opens the "not here" page.

What is the root cause of that problem?

I reproduced this on staging (9.5.34-1). It only happens when Member details is opened while the invite request is still in flight. If you wait for the invite to finish, Display name opens fine.

  1. While the invite is pending, the members list links the row with an optimistic accountID (654756983 in my test). When the request succeeds, the backend returns the real accountID (23559250), and the optimistic personal details entry loses its login. The Member details URL keeps the optimistic ID.

  2. WorkspaceMemberDetailsPage already handles this. It recovers the login from the policy and resolves the real accountID: https://github.com/Expensify/App/blob/679833bbb0d4663b9fa4e80162cdc9df79c06dc4/src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx#L152-L156

    Every row on that page then opens its sub-page with that resolved accountID. Role, Office location, Work arrangement, Custom fields and Category visibility all do this, for example: https://github.com/Expensify/App/blob/679833bbb0d4663b9fa4e80162cdc9df79c06dc4/src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx#L554

  3. The Display name row, added in #105050, is the only exception. It calls createDynamicRoute(...) without a base path, so it appends /display-name to the current URL. That URL still carries the stale optimistic ID: https://github.com/Expensify/App/blob/679833bbb0d4663b9fa4e80162cdc9df79c06dc4/src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx#L529

    WorkspaceMemberDisplayNamePage then reads personal details for an ID that no longer has a login, so isPolicyMember is false and the page is blocked.

On the same member, in the same session:

  • /members/654756983/display-name (the optimistic ID) shows "not here".
  • /members/23559250/display-name (the real ID) opens the editor.
  • The Role row from the same stale Member details page goes to /members/23559250/role and works.

The Role and Office location pages look up the member exactly like the Display name page does (personalDetails[accountID]?.login). They work only because their link already carries the real ID. So the problem is the link the Display name row builds, not the lookup in the Display name page.

What changes do you think we should make in order to solve the problem?

  1. In WorkspaceMemberDetailsPage, build the Display name route from the resolved member route, the same way every sibling row does: createDynamicRoute(DYNAMIC_ROUTES.WORKSPACE_MEMBER_DISPLAY_NAME.path, ROUTES.WORKSPACE_MEMBER_DETAILS.getRoute(policyID, accountID)). Passing a base path to createDynamicRoute is already used elsewhere, for example REPORT_DETAILS in ReportUtils.
  2. Nothing changes in WorkspaceMemberDisplayNamePage. With the real ID in its route, its lookup, guard and updatePolicyMemberDisplayName call (optimistic data written to the real personal details entry) already work. Back navigation still returns to Member details for the same member.
  3. Add a UI test: render Member details with a stale optimistic accountID in the route and a policy member whose personal details use the real ID, press Display name, and assert that the navigation target contains the real accountID.

Offline: while the invite is still queued, the optimistic entry keeps its login, so the resolved ID equals the route ID and nothing changes.

What alternative solutions did you explore? (Optional)

Also correct the Member details URL (tested). With the change above, the address bar still shows the optimistic ID (/members/654756983/display-name), because a dynamic route's URL is built from the path of the screen underneath (getPathFromStateWithDynamicRoute). So a refresh on that page would still show "not here". To fix that too, WorkspaceMemberDetailsPage can replace its own accountID route param once it has resolved the real one. When the resolved accountID differs from the route's, call Navigation.setParams({accountID}) after Navigation.isNavigationReady(), the same pattern ReportRouteParamHandler uses for reportID. I tested this locally:

  • Opening the stale /members/<optimistic ID> URL switches the address bar to the real ID.
  • Display name opens the editor, still works after a refresh, and saves correctly.

Because every sub-page link then starts from the real ID, the Display name link would work even without a base path. It's one small effect instead of a one-line change, so I'd use it if we also want the URL refresh-safe.

I also considered adding a getMemberLoginByAccountID fallback inside WorkspaceMemberDisplayNamePage, as the other proposals suggest. It hides the problem, but the page then has to remap the stale ID to the real one before saving. It also adds a third copy of the resolution logic that WorkspaceMemberDetailsPage already does, while the Role and Office location pages keep relying on the parent passing the real ID. Fixing the one link that skips the resolved ID keeps a single place responsible for resolving the member.

Tested

I applied the one-line change locally (dev web, staging API) and opened the same Member details page twice, with the stale optimistic ID in the URL after the invite had finished:

  • Without the change: Display name shows "not here".
  • With the change: Display name opens the editor. Saving writes the name to the real personal details entry, nothing is written under the stale ID, and Member details shows the new name.

Before (main)

https://github.com/user-attachments/assets/988dbc6b-1863-4669-bbaf-7ad17137f6b5

After (with the change)

https://github.com/user-attachments/assets/7ee07750-1271-401d-9699-e7dd34896d2d

sam5235 avatar Nov 09 '26 20:11 sam5235