App: CRITICAL: [$500] Inviting a member to a user created room does not add them until page is refreshed

Problem

Originally reported by @quinthar here

Reproduction steps:

  • Navigate to expensify.com/new/room
  • Invite a member (must be a new account and not someone who you have a personal detail for yet)
  • See that the member is not included in the list
  • Refresh the page
  • See that the member is included in the list

Why is this important?

Ideally the member would be displayed immediately.

Solution

@jasperhuangg I think maybe we need to add an optimistic personal detail for the user being added? Or something is wrong with the accountID logic in the front end. When we add a new member to a room we are using an optimistic accountID generated in the options. But we do not add optimistic personal details for them here. So this logic here is hit.

Confirmed with this log:

2023-12-05_12-01-28

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01b17b3e302b4beccb
  • Upwork Job ID: 1733076588418981888
  • Last Price Increase: 2023-12-08
  • Automatic offers:
    • hoangzinh | Reviewer | 28027117
    • dukenv0307 | Contributor | 28027118

About this issue

  • Original URL
  • State: closed
  • Created 7 months ago
  • Comments: 25 (15 by maintainers)

Most upvoted comments

@dukenv0307 Thanks for your proposal. Your RCA is correct and your solution, overall is correct. I only suggest that we can do the same as we did when we invite a member to a workspace here https://github.com/Expensify/App/blob/632c5c6fb416e330cc90878b6258a9b5e23347cb/src/libs/actions/Policy.js#L541

Link to proposal https://github.com/Expensify/App/issues/32712#issuecomment-1846974404 πŸŽ€πŸ‘€πŸŽ€ C+ reviewed

Created https://github.com/Expensify/Expensify/issues/356696 to update regression tests, closing this out

Regression Test Proposal

  1. Create a new room
  2. Go to room details page
  3. Press on β€œMembers” menu
  4. Press on Invite button
  5. Invite a member (must be a new account and not someone whom you have personal details for yet)
  6. Verify that on the room’s members page, this member appears immediately

Do we agree πŸ‘ or πŸ‘Ž

paid! @hoangzinh can you propose Regression Test steps please?