[$175] Invited member is displayed after refresh the page
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.13-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://github.com/Expensify/App/pull/102727 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: windows 10/chrome App Component: Chat Report View
Action Performed:
Precondition: User A creates two expenses to User B
Steps:
- User B opens one of the expenses> click on header> members
- Invite a member with non-existing account
Expected Result:
Invited member should be displayed in members list
Actual Result:
Invited member is not displayed in members list, it only appears after refreshing the page
Workaround:
Unknown
Platforms:
- [ ] Android: App
- [ ] Android: mWeb Chrome
- [ ] iOS: App
- [ ] iOS: mWeb Safari
- [ ] iOS: mWeb Chrome
- [x] Windows: Chrome
- [ ] MacOS: Chrome Safari
Screenshots/Videos
https://github.com/user-attachments/assets/4ad0833c-1d62-4906-b303-578675d5138e
Applause Internal Information Exported by: Svetlana Lazutkina Bug ID: 7288118
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022111145804522409510
- Upwork Job ID: 2111145804522409510
- Last Price Increase: 2026-10-16
Issue Owner
Current Issue Owner: @arosiclair
While Applause doesn't embed attachments for this bug, here are the links for quick view: https://platform.applause.com/services/links/v1/external/d3be2aefa33631aa10fe723f035987bdac29b56d23432d26282aa1dd94689ad3
⚠️ Preliminary analysis (low confidence) — treat as a starting point, not a conclusion.
I think the invited member disappears as soon as the invite succeeds, not that it never shows up. For a brand-new email, the app adds a temporary member with a temporary accountID. When the InviteToRoom request succeeds, the app deletes that temporary member (participants[tempID] = null, success data) and its temporary personal details. It then relies on the server response to add the real member back.
The members list hides anyone who isn't in report.participants or has no personal details (getParticipantsList). If the response is missing the real participant or their personal details for this report type, the row drops. Nothing reloads the list until a refresh, because DynamicRoomMembersPage fetches members only when it first opens. Inviting someone who already has an account isn't affected, because nothing is deleted for them.
I couldn't verify this because I can't see what the server returns. This appears to be a backend/internal issue. A separate internal investigation is needed.
To confirm:
- Go offline, invite a new email, and check that the row stays (greyed out). Then go online and check whether it disappears.
- Inspect the
InviteToRoomnetwork response and check whether it includesreport_<reportID>.participantsandpersonalDetailsListentries for the new accountID.
If the response is missing those entries, the fix belongs on the backend. A possible App-side workaround is to reload room members after an invite that includes new accounts.
Investigation details
- Which page: Members on a transaction thread opens
DynamicRoomMembersPage(routing). On the expense report, it opensDynamicReportParticipantsPage. Both invite pages callinviteToRoom(room, expense report). - Before success: the temporary row should pass every list filter. I found no role check, filter, or different reportID that would hide it.
- Order: the app applies the server response first, then success data, then finally data (
OnyxUpdates.ts). So the temporary entries are removed whether or not the server added the real ones. - Regression check: recent changes to these pages, including Feat: add invite on money requests, didn't change the invite data. Nothing points to an App regression.
- Alternative: the row may never render at all. Step 1 above tells these cases apart.
Next Steps: Reply with @MelvinBot <your feedback> to refine this analysis.
Triggered auto assignment to Contributor-plus team member for initial proposal review - @marufsharifi (External)
Job added to Upwork: https://www.upwork.com/jobs/~022111145804522409510
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01b60d704ba377be83
Proposal
Please re-state the problem that we are trying to solve in this issue.
Inviting a new member with a non-existing account to an expense thread or room leaves the member missing from the members list until the page is refreshed.
What is the root cause of that problem?
- In src/libs/actions/Report/index.ts:5721-5766 (uildInviteToRoomOnyxData), inviting a new non-existing email creates a temporary optimistic account ID ( ewAccountIDs).
- optimisticData adds this temporary account ID to eport.participants and creates temporary personal details via PersonalDetailsUtils.getPersonalDetailsOnyxDataForOptimisticUsers.
-
However, successData unconditionally cleans up the optimistic data:
ewParticipantAccountCleanUp sets eport.participants[newAccountID] = null.
ewPersonalDetailsOnyxData.finallyData purges the temporary personal details. 4. For expense threads and chat rooms, the backend InviteToRoom command returns the new real participant ID in the response, but omits the matching personalDetailsList entry. 5. In src/libs/ReportUtils.ts, getParticipantsList() (consumed by DynamicRoomMembersPage) requires every participant to have an existing record in personalDetailsList. Because successData purged the temporary personal details and the server did not supply real personal details, getParticipantsList() filters out the participant. 6. A subsequent OpenRoomMembersPage only returns participants without their personal details, so standard refetches fail to supply the missing records without explicitly fetching personal details.
What changes do you think we should make in order to solve the problem?
Frontend Solution:
In src/pages/DynamicRoomMembersPage.tsx:
- Use getParticipantsAccountIDsForDisplay(report, true, true, false, reportMetadata, personalDetails) to identify all valid participant account IDs in the room.
- For any participant whose personal details are missing from Onyx after initial load, invoke openPublicProfilePage(accountID) (from src/libs/actions/PersonalDetails.ts).
- Guard this fetch with a ref set per report/accountID to guarantee only a single fetch is triggered without causing duplicate requests or re-render loops. Once the public profile resolves, Onyx updates personalDetailsList, automatically restoring the member row and count in DynamicRoomMembersPage.
Backend Alternative:
Ensure the InviteToRoom backend API returns the corresponding personalDetailsList[accountID] entry alongside
eport_
What alternative solutions did you explore? (Optional)
- Refetching openRoomMembersPage(reportID) alone: verified that OpenRoomMembersPage only returns participants without personal details, which does not resolve getParticipantsList() filtering.
- Retaining temporary optimistic personal details in inallyData: rejected because the temporary account ID differs from the real account ID assigned by the backend, leading to mismatched lookups and duplicate participant rows once the real account is fetched.
:warning: Unable to store contributor details
Details
Auth SetContributorDetails returned an error 401 Contributor details already exist
Proposal
Please re-state the problem that we are trying to solve in this issue.
User A creates two expenses for User B. User B opens one of the expenses, taps the header, opens Members, and invites a member whose email has no existing Expensify account. The invited member is not shown in the members list after the invite, and the member count stays unchanged. The invited member only appears after the page is refreshed.
What is the root cause of that problem?
For a login with no existing account, DynamicRoomInvitePage passes an optimistic accountID, generated by hashing the login in generateAccountID, to inviteToRoom. In buildInviteToRoomOnyxData in src/libs/actions/Report/index.ts, that optimistic ID is added to report.participants and an optimistic personal detail is created for it through getPersonalDetailsOnyxDataForOptimisticUsers in PersonalDetailsUtils. The success data for the same request then unconditionally cleans both up: it sets participants[optimisticID] to null and deletes the optimistic personal detail. That cleanup assumes the InviteToRoom response has already added the participant and the personal detail under the real accountID that the server creates for the new login.
For an expense thread, that response does not add the thread participant or the personal detail for the newly created account, so after the success cleanup nothing for the invited member is left in Onyx. The list could not show the member even if a participant entry remained, because getParticipantsList in src/libs/ReportUtils.ts, used by DynamicRoomMembersPage, filters out any participant who has no personal detail, and DynamicRoomMembersPage builds its rows only from participants with personal details.
Nothing then reloads the members. DynamicRoomMembersPage calls openRoomMembersPage(reportID) only once, in its mount effect, and the invite page navigates back to that already mounted page. A refresh remounts the page, runs OpenRoomMembersPage, and that read returns the real participant and personal detail, which is why the invited member appears only after a refresh. Inviting a login that already has an account is not affected, because no optimistic account is created or cleaned up for it.
What changes do you think we should make in order to solve the problem?
In inviteToRoom in src/libs/actions/Report/index.ts, when the invite includes new accounts, meaning newAccountIDs is not empty, queue an openRoomMembersPage(report.reportID) read for the same report right after the InviteToRoom write. Requests run in order, so the read runs after the invite has been processed and returns the participant and the personalDetailsList entry the server created under the real accountID. Merging that read into Onyx replaces the cleaned up optimistic entries with the real ones.
Keep the existing optimistic data and success cleanup in buildInviteToRoomOnyxData unchanged, and do not trigger the extra read when every invited login already has an account, since those invites already update correctly from the write response. This also covers DynamicReportParticipantsInvitePage, which reaches the same code through inviteToGroupChat.
Result: after inviting a member with a non existing account to an expense thread, returning to Members shows the invited member right away, with the correct member count, and no refresh is needed. Invites of existing accounts, and the members list itself, behave as before.
What alternative solutions did you explore? (Optional)
Keeping the optimistic participant and the optimistic personal detail in the success data, instead of cleaning them up. I did not choose this because the optimistic accountID is a hash of the login, not the real accountID, so the row would point at the wrong account, member details and removal would act on the wrong ID, and a duplicate row would appear once the real personal detail is loaded later.
Refetching members in DynamicRoomMembersPage every time the page regains focus. This would fix the list when the user returns to it, but the report details member count would still be wrong until the members page is reopened, and every return to the page would pay for a read that is only needed after an invite of a new account.
@marufsharifi I verified this with the actual API responses.
InviteToRoom successfully returns the new real participant ID, but it does not return the matching personalDetailsList entry. The client then correctly removes the temporary participant/details, and getParticipantsList() hides the real participant because their personal details are missing.
OpenRoomMembersPage also returns only the participant list, without personal details, so an App-side refetch would not fix the root cause.
This is a backend issue: InviteToRoom should return the new account’s personalDetailsList[realAccountID] entry together with report_<reportID>.participants[realAccountID].
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0126a1db3ee4419254
Proposal
Please re-state the problem that we are trying to solve in this issue.
When inviting a new member with an email that does not have an existing Expensify account to an expense report/thread (via Header > Members > Invite), the invited member does not appear in the members list. The member only appears after refreshing the page.
What is the root cause of that problem?
- In
src/libs/actions/Report/index.ts(buildInviteToRoomOnyxData), when inviting a non-existing email, a temporary optimistic account ID is generated (newAccountIDs). optimisticDataadds the optimistic account ID toreport.participantsand creates temporary personal details viaPersonalDetailsUtils.getPersonalDetailsOnyxDataForOptimisticUsers.- However,
successData(lines 5750–5766) unconditionally cleans up the optimistic data:- Sets
report.participants[newAccountID] = null - Executes
newPersonalDetailsOnyxData.finallyDatawhich removes the temporary personal details.
- Sets
- For expense reports and threads, the backend
InviteToRoomresponse returns the participant, but does not include the correspondingpersonalDetailsListentry for the newly created user. - In
src/libs/ReportUtils.ts,getParticipantsList()(used byDynamicRoomMembersPage) requires each participant to have a corresponding entry inpersonalDetailsList. BecausesuccessDatapurged the temporary personal details and the server did not return them, the invited member is filtered out of the member list. DynamicRoomMembersPageonly callsopenRoomMembersPage(reportID)once on mount, so navigating back fromDynamicRoomInvitePagedoes not reload the members or fetch their personal details.
What changes do you think we should make in order to solve the problem?
Frontend Solution:
- In
src/libs/actions/Report/index.tsinsideinviteToRoom, whennewAccountIDs.length > 0, scheduleopenRoomMembersPage(report.reportID)read directly after theInviteToRoomAPI write:
Sequential API execution guarantees thatif (newAccountIDs.length > 0) { openRoomMembersPage(report.reportID); }OpenRoomMembersPageruns after the invitation is processed, fetching the updated member list and personal details. - In
buildInviteToRoomOnyxData, do not clean up the optimistic personal details infinallyDataif the server response doesn't supply replacement personal details, ensuringgetParticipantsList()continues to find details for the participant until reconciled.
Backend Alternative (If backend fix preferred):
Ensure the InviteToRoom API command returns personalDetailsList for the newly created account alongside report_<reportID>.participants.
What alternative solutions did you explore? (Optional)
Looked into refetching members on every focus in DynamicRoomMembersPage. Triggering openRoomMembersPage specifically when newAccountIDs.length > 0 in inviteToRoom is much more efficient as it only performs a read when a new account has actually been invited.
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Proposal
Please re-state the problem that we are trying to solve in this issue.
Inviting a new member to an expense thread leaves the member missing from the Members list and the count unchanged until the page is refreshed.
What is the root cause of that problem?
I reproduced this in desktop Chrome, confirming emkhalid's finding: InviteToRoom returns the real participant without its personal details. Success cleanup correctly removes the temporary ID/details; getParticipantsList then filters out the real ID.
An explicit OpenRoomMembersPage request also omitted those details. Opening the missing member's public profile fetched them and restored the member without refreshing the document.
What changes do you think we should make in order to solve the problem?
In DynamicRoomMembersPage, inspect visible IDs before the details-dependent selector:
getParticipantsAccountIDsForDisplay(report, true, true, false, reportMetadata, personalDetails);
After isPersonalDetailsReady(personalDetails), call openPublicProfilePage(accountID) for valid IDs still missing details. Exclude hidden/deleted members and IDs whose latest pending action is ADD. Mark each report/account pair before requesting, allowing one attempt per mounted page without retry loops.
Keep optimistic cleanup, selectors and removal protections unchanged. The profile response updates Onyx, restoring the existing row/count. Public fields without login are sufficient.
The implementation passes 11 focused mocked-API tests covering readiness, pending additions, temporary-to-real replacement, deduplication, unresolved reads, hidden/deleted members, loginless profiles and parent IOU owner/manager protection. Changed-file lint, full typecheck, Babel/OXC compiler checks and spelling checks pass.
Browser evidence used 198b7a; the relevant invite/filter/profile functions are unchanged at implementation base ef784ba. Manual profile-read recovery was verified; the automatic patched UI has not yet been exercised end to end.
What alternative solutions did you explore? (Optional)
A members refetch did not supply the missing details. Retaining temporary details does not fill the real-ID lookup. Returning details directly from InviteToRoom remains the upstream alternative.
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0163955a2ba22190aa
Proposal
Please re-state the problem that we are trying to solve in this issue.
When inviting a new member with a non-existing account to an expense report, the invited member is not displayed in the members list immediately and only appears after manually refreshing the page.
What is the root cause of that problem?
In src/libs/actions/Report.ts (inside inviteToReport / inviteToRoom):
When inviting an email that does not yet exist in Onyx personalDetails, the optimistic data writes the invitation notification but fails to add the temporary/optimistic account ID to report.participantAccountIDs in the optimistic Onyx payload. As a result, the members list component (which reads from report.participantAccountIDs) does not re-render until the backend command completes and returns the full report object on reload.
What changes do you think we should make in order to solve the problem?
In src/libs/actions/Report.ts, include the invited account ID in the optimistic report.participantAccountIDs:
const optimisticData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
value: {
participantAccountIDs: [...(report?.participantAccountIDs ?? []), invitedAccountID],
},
},
];
This ensures the members list updates instantly without requiring a page refresh.
What specific scenarios should we cover in automated tests?
In tests/unit/ReportTest.ts:
- Test that inviting a non-existing account ID updates
report.participantAccountIDsoptimistically before the network request resolves.
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Proposal
Please re-state the problem that we are trying to solve in this issue.
When inviting a member with a newly created / non-existing account to an expense thread or room (via expense header > Members > Invite), the invited member does not appear in the members list immediately after completing the invitation, and only becomes visible after manually refreshing the page.
What is the root cause of that problem?
-
Optimistic Data vs Success Data Cleanup in
buildInviteToRoomOnyxData: Insrc/libs/actions/Report/index.ts(lines 5721–5766), when inviting a login that does not yet exist in personal details, an optimistic temporary account ID is generated (newAccountIDs).optimisticDataadds the temporary account ID toreport.participantsand creates temporary personal details in Onyx viaPersonalDetailsUtils.getPersonalDetailsOnyxDataForOptimisticUsers.- However,
successDataunconditionally cleans up the optimistic entries:
andreport.participants[newAccountID] = null;newPersonalDetailsOnyxData.finallyDatapurges the temporary optimistic personal details.
-
Missing Real Personal Details in Expense Thread Response: For money request / expense threads, the backend
InviteToRoomAPI response creates the real user account on the backend and registers the participant, but does not bundle the newly created user'spersonalDetailsListentry in the immediate write response. -
Filtering in
getParticipantsList: Insrc/libs/ReportUtils.ts,getParticipantsList(which populatesDynamicRoomMembersPage) strictly requires each participant to have an entry inpersonalDetailsList. BecausesuccessDatapurged the temporary optimistic personal details, and the immediate server response did not include the permanent personal details,getParticipantsListfilters out the newly invited participant. -
Page Mount Refetch Gap:
DynamicRoomMembersPageonly invokesopenRoomMembersPage(reportID)once upon mounting (useEffect). When the user navigates back from the Invite sub-page,DynamicRoomMembersPageis already mounted, so it does not re-fetch room members. A manual browser refresh remounts the component, firingopenRoomMembersPage, which returns the complete participant and personal details data from the server.
What changes do you think we should make in order to solve the problem?
In src/libs/actions/Report/index.ts (inside inviteToRoom):
When newAccountIDs is not empty (i.e., when inviting at least one new account that required optimistic account generation), automatically trigger openRoomMembersPage(report.reportID) right after queuing the InviteToRoom command.
Because sequential API requests run in order on the client queue, openRoomMembersPage executes immediately after InviteToRoom finishes processing on the backend. The read response fetches the real participant record and personalDetailsList under the newly created account ID, merging them into Onyx and seamlessly rendering the invited member row without requiring a browser refresh.
--- a/src/libs/actions/Report/index.ts
+++ b/src/libs/actions/Report/index.ts
@@ -5785,6 +5785,10 @@ function inviteToRoom(report: OnyxEntry<Report>, invitedEmailsToAccountIDs: Invi
API.write(WRITE_COMMANDS.INVITE_TO_ROOM, parameters, onyxData);
+
+ if (newAccountIDs.length > 0 && report?.reportID) {
+ openRoomMembersPage(report.reportID);
+ }
}
This also cleanly covers DynamicReportParticipantsInvitePage (which routes through inviteToGroupChat / inviteToRoom) with zero extra overhead when inviting existing users.
What alternative solutions did you explore? (Optional)
- Polling
openPublicProfilePage(accountID)for missing participants inDynamicRoomMembersPage: Rejected because it introduces component-level ref tracking and individual HTTP requests per missing participant, whereas chainingopenRoomMembersPageinside the action cleanly re-syncs the entire room state via the standard API pipeline.
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0139ed4098bdc50182
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
@marufsharifi Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
Backend Issue
When we invite a user, the frontend creates a temporary account ID and personal details, so the member appears immediately. After the server responds, the frontend removes the temporary data. However, the response includes the real participant ID without the corresponding personal details, causing the member to disappear from the list. Refreshing the app fetches the missing personal details through OpenReport, and the member appears again.
https://github.com/user-attachments/assets/d79b74a5-97b0-498d-bb5a-b522a432fc3a
🎀 👀 🎀 C+ reviewed
Triggered auto assignment to @arosiclair, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
Sounds like InviteToRoom needs to be updated to return personal details for the invited user.
Okay the root problem for this is that we don't push personal details to users with a hidden notification preference and in this case, the inviter is hidden. We should be able to stop excluding hidden members for this use case. I'm drafting a PR for this.