Skip to content

Add optimistic participant update for actionable mention whisper invite#88795

Merged
Valforte merged 10 commits intomainfrom
claude-fixMembersListRefreshAfterWhisperInvite
Apr 29, 2026
Merged

Add optimistic participant update for actionable mention whisper invite#88795
Valforte merged 10 commits intomainfrom
claude-fixMembersListRefreshAfterWhisperInvite

Conversation

@MelvinBot
Copy link
Copy Markdown
Contributor

@MelvinBot MelvinBot commented Apr 26, 2026

Explanation of Change

When a user mentions someone not in a conversation and clicks "Invite to chat" on the actionable mention whisper, the resolveActionableMentionWhisper function only optimistically updates the whisper's resolution and the report's last message -- it does not add the invited user to report.participants in Onyx. Because the members list page reads from report.participants, the new member doesn't appear until the server response arrives or the user refreshes.

This PR adds an optimistic update for report.participants when the resolution is 'invited', mirroring the pattern already used in inviteToRoom. The invited account IDs are extracted from the whisper's originalMessage.inviteeAccountIDs and added to participants with the default notification preference and member role. On failure, the original participants are restored.

Fixed Issues

$ #88706
PROPOSAL: #88706 (comment)

Tests

  1. Open the IOU report
  2. Mention the new member
  3. Invite to the chat only
  4. Open the report header
  5. Verify that the new member appears
  • Verify that no errors appear in the JS console

Offline tests

Same as above

QA Steps

Same as above

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

…n whisper

When a user invites someone through an actionable mention whisper,
the report.participants was not optimistically updated in Onyx. This
caused the members list to not show the new member until a page refresh.

Co-authored-by: dukenv0307 <dukenv0307@users.noreply.github.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 26, 2026

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
src/pages/inbox/report/PureReportActionItem.tsx 79.66% <ø> (ø)
src/libs/actions/Report/index.ts 69.74% <87.50%> (+0.53%) ⬆️
...ox/report/actionContents/MentionWhisperContent.tsx 61.90% <22.22%> (-24.77%) ⬇️
... and 132 files with indirect coverage changes

@dukenv0307
Copy link
Copy Markdown
Contributor

@MelvinBot please add tests for your change to make sure we don't decrease code coverage

…update

Add two test cases:
1. Verify that invitees are optimistically added to report.participants
   with default notification preference and member role when resolution
   is INVITE
2. Verify that participants are NOT updated when resolution is NOTHING

Co-authored-by: dukenv0307 <dukenv0307@users.noreply.github.com>
@MelvinBot
Copy link
Copy Markdown
Contributor Author

Added two tests for resolveActionableMentionWhisper in tests/actions/ReportTest.ts:

  1. INVITE resolution — verifies invitees are optimistically added to report.participants with the default notification preference and MEMBER role, while existing participants remain unchanged
  2. NOTHING resolution — verifies participants are NOT modified when the user chooses not to invite

Both tests pass locally. ✅

@dukenv0307
Copy link
Copy Markdown
Contributor

@MelvinBot Please complete the checklist

@dukenv0307
Copy link
Copy Markdown
Contributor

@codex review

@MelvinBot
Copy link
Copy Markdown
Contributor Author

Updated the PR Author Checklist:

  • Checked off all N/A conditional items (no new files, CSS, assets, UI changes, generic components, Storybook, deeplinks, or message editing code)
  • Checked the unit tests item (tests were added in the previous commit)

Still needs the human co-author (dukenv0307):

  • Tests / Offline tests / QA steps sections
  • Screenshots/videos on all platforms
  • Platform testing verification
  • Console error verification

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e3b578d08b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/libs/actions/Report/index.ts Outdated
);

participantsOptimisticData = {participants: participantsAfterInvitation};
participantsFailureData = {participants: report.participants};
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Guard rollback against undefined participants

Store report.participants in participantsFailureData only when it is defined; otherwise the failure path cannot undo the optimistic invite. Report.participants is optional, and when it is absent this line records {participants: undefined}. Because Onyx.merge() strips undefined fields (documented in-repo at tests/unit/FraudProtectionTest.ts:120), the failure merge at this call site becomes a no-op for participants, so failed ResolveActionableMentionWhisper requests can leave invited users stuck in the members list until a full refresh.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MelvinBot let's check this

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MelvinBot let's check this comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — report.participants is optional and could be undefined, which would cause the failure rollback to merge undefined into Onyx (a no-op), leaving the optimistic participants in place.

Fixed in a6826d3 by adding a nullish coalescing fallback: report.participants ?? {}.

@MelvinBot
Copy link
Copy Markdown
Contributor Author

All CI checks are passing ✅

  • Tests (8 shards): all passed
  • Typecheck: passed
  • ESLint / Prettier / Spellcheck: passed
  • Codecov: coverage increased (+0.82%), new code at 100% coverage
  • Perf tests / Storybook / React Compiler: passed

The only failing checks are the PR Author/Reviewer Checklists, which are expected until the human co-author fills in the Tests/Offline/QA sections and screenshots.

Use nullish coalescing to ensure participantsFailureData always has a
defined value. When report.participants is undefined, the failure path
now restores an empty object instead of merging undefined into Onyx.

Co-authored-by: dukenv0307 <dukenv0307@users.noreply.github.com>
@dukenv0307
Copy link
Copy Markdown
Contributor

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a6826d312a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/libs/actions/Report/index.ts Outdated
);

participantsOptimisticData = {participants: participantsAfterInvitation};
participantsFailureData = {participants: report.participants ?? {}};
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove optimistic invitees when resolve action fails

participantsFailureData restores report.participants with Onyx.METHOD.MERGE, but Onyx merge is a deep merge, so keys added optimistically for inviteeAccountIDs are not deleted when absent from the rollback object. In a failed RESOLVE_ACTIONABLE_MENTION_WHISPER request (e.g., offline/server error), the invited users remain in report.participants and the members list shows phantom members instead of reverting. Rollback needs explicit null cleanup for each optimistic account ID (or a full replace) to truly restore prior state.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MelvinBot pls check it

@dukenv0307
Copy link
Copy Markdown
Contributor

@MelvinBot participantsFailureData restores report.participants with Onyx.METHOD.MERGE, but Onyx merge is a deep merge, so keys added optimistically for inviteeAccountIDs are not deleted when absent from the rollback object. In a failed RESOLVE_ACTIONABLE_MENTION_WHISPER request (e.g., offline/server error), the invited users remain in report.participants and the members list shows phantom members instead of reverting. Rollback needs explicit null cleanup for each optimistic account ID (or a full replace) to truly restore prior state.

Onyx.METHOD.MERGE does a deep merge, so the failure data must
explicitly null out each invitee key that was added optimistically.
Without this, failed requests leave phantom members in the
participants list.

Also add a test verifying that failure rollback properly removes
the optimistically added participants.

Co-authored-by: dukenv0307 <dukenv0307@users.noreply.github.com>
@MelvinBot
Copy link
Copy Markdown
Contributor Author

Good catch — fixed. The failure data now explicitly sets each optimistically-added invitee key to null so Onyx's deep merge removes them on rollback, matching the pattern used in inviteToRoom.

Also added a third test that verifies failure rollback properly removes phantom participants.

…assertions

Co-authored-by: dukenv0307 <dukenv0307@users.noreply.github.com>
@MelvinBot
Copy link
Copy Markdown
Contributor Author

Fixed the failing ESLint check:

  • src/libs/actions/Report/index.ts:5422: Replaced .forEach() with for...of loop and used early continue instead of wrapping the body in a conditional (unicorn/no-array-for-each, rulesdir/prefer-early-return)
  • tests/actions/ReportTest.ts:7266,7275,7276: Removed unnecessary non-null assertions (!) on mockFetch.pause, mockFetch.fail, and mockFetch.resume — these methods are not optional in the MockFetch type (@typescript-eslint/no-unnecessary-type-assertion, @typescript-eslint/no-non-null-assertion)

@MelvinBot
Copy link
Copy Markdown
Contributor Author

⚠️ MelvinBot CI Fix Loop Detected

MelvinBot has made 5 consecutive commits trying to fix CI failures. Automatic CI fix dispatches are now paused for this PR.

Next steps: A human should review the recent commits and resolve the conflicting CI errors manually.

@dukenv0307
Copy link
Copy Markdown
Contributor

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d8f60d0334

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/libs/actions/Report/index.ts Outdated
Comment on lines +5406 to +5410
notificationPreference: defaultNotificationPreference,
role: CONST.REPORT.ROLE.MEMBER,
};
// eslint-disable-next-line no-param-reassign
reportParticipants[accountID] = participant;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve existing participant settings when inviting

In resolveActionableMentionWhisper, the optimistic invite path always writes a fresh {notificationPreference: default, role: MEMBER} object for every inviteeAccountID. If the actionable whisper is stale (for example, that user was already added to the room before this button press), this overwrites the existing participant entry and can downgrade role/notification settings in Onyx; because there is no success rollback for participants, the wrong values can persist until a later server sync. Skip rewriting IDs that already exist in report.participants and only add truly new participants.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Fixed — the reduce now skips accountIDs that already exist in report.participants, so existing role/notification settings won't be overwritten by a stale whisper. See src/libs/actions/Report/index.ts:5406-5409 (

if (accountID in (report.participants ?? {})) {
return reportParticipants;
}
const participant: ReportParticipant = {
). Added a dedicated test for the stale-whisper scenario as well.

@dukenv0307
Copy link
Copy Markdown
Contributor

P2 Badge Preserve existing participant settings when inviting

In resolveActionableMentionWhisper, the optimistic invite path always writes a fresh {notificationPreference: default, role: MEMBER} object for every inviteeAccountID. If the actionable whisper is stale (for example, that user was already added to the room before this button press), this overwrites the existing participant entry and can downgrade role/notification settings in Onyx; because there is no success rollback for participants, the wrong values can persist until a later server sync. Skip rewriting IDs that already exist in report.participants and only add truly new participants.

@MelvinBot please check

Skip inviteeAccountIDs that already exist in report.participants to
avoid overwriting their role/notification settings. Add a dedicated
test for the stale-whisper scenario.

Co-authored-by: dukenv0307 <dukenv0307@users.noreply.github.com>
@dukenv0307
Copy link
Copy Markdown
Contributor

Looks good to me

@dukenv0307
Copy link
Copy Markdown
Contributor

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1879ec115f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/libs/actions/Report/index.ts Outdated
// Onyx.METHOD.MERGE does a deep merge, so simply restoring the original participants
// won't remove keys that were added optimistically. We must explicitly null out each
// invitee's entry so Onyx deletes them on failure rollback.
const participantsRollback: Record<number, ReportParticipant | null> = {...report.participants};
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Limit failure rollback to newly invited participant keys

The rollback payload currently copies the entire report.participants snapshot and then adds null entries for new invitees. If RESOLVE_ACTIONABLE_MENTION_WHISPER fails after other participant changes happen (for example, another member is removed or a role/notification preference is updated while the request is in flight), this stale snapshot is merged back and can unintentionally restore outdated participant data. On failure, this rollback should only include null entries for the newly added invitees so unrelated participant updates are preserved.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MelvinBot pls check

Copy link
Copy Markdown
Contributor Author

@MelvinBot MelvinBot Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Fixed in 67d705b — the failure rollback now only contains null entries for the newly added invitee keys instead of spreading the full report.participants snapshot. This avoids overwriting concurrent participant changes that may happen while the request is in flight.

See src/libs/actions/Report/index.ts:5425-5433 (and the matching parent report rollback at lines 5461-5467).

@dukenv0307
Copy link
Copy Markdown
Contributor

@MelvinBot It doesn't work for the oneTransactionThreadReport

@dukenv0307
Copy link
Copy Markdown
Contributor

@MelvinBot You completed 42 out of 50 checklist items with 0 unfinished items
Make sure you are using the most up to date checklist found here:

<!-- If necessary, assign reviewers that know the area or changes well. Feel free to tag any additional reviewers you see fit. -->

### Explanation of Change
<!-- Explain what your change does and how it addresses the linked issue -->

### Fixed Issues
<!---
1. Please postfix `$` with a URL link to the GitHub issue this Pull Request is fixing. For example, `$ https://github.com/Expensify/App/issues/<issueID>`.
2. Please postfix  `PROPOSAL:` with a URL link to your GitHub comment, which contains the approved proposal (i.e. the proposal that was approved by Expensify).  For example, `PROPOSAL: https://github.com/Expensify/App/issues/<issueID>#issuecomment-1369752925`

Do NOT add the special GH keywords like `fixed` etc, we have our own process of managing the flow.
It MUST be an entire link to the github issue and your comment proposal ; otherwise, the linking and its automation will not work as expected.

Make sure this section looks similar to this (you can link multiple issues using the same formatting, just add a new line):

$ https://github.com/Expensify/App/issues/<issueID>
$ https://github.com/Expensify/App/issues/<issueID(comment)>

Do NOT only link the issue number like this: $ #<issueID>
--->
$
PROPOSAL:


<!--- 
If you want to trigger adhoc build of hybrid app from specific Mobile-Expensify PR please link it like this:

MOBILE-EXPENSIFY: https://github.com/Expensify/Mobile-Expensify/pull/<PR-number>

--->

### Tests
<!---
Add a numbered list of manual tests you performed that validates your changes work on all platforms, and that there are no regressions present.
Add any additional test steps if test steps are unique to a particular platform.
Manual test steps should be written so that your reviewer can repeat and verify one or more expected outcomes in the development environment.

For example:
1. Click on the text input to bring it into focus
2. Upload an image via copy paste
3. Verify a modal appears displaying a preview of that image
--->

- [ ] Verify that no errors appear in the JS console

### Offline tests
<!---
Add any relevant steps that validate your changes work as expected in a variety of network states e.g. "offline", "spotty connection", "slow internet", etc. Manual test steps should be written so that your reviewer and QA testers can repeat and verify one or more expected outcomes. If you are unsure how the behavior should work ask for advice in the `#expensify-open-source` Slack channel.
--->

### QA Steps
<!---
Add a numbered list of manual tests that can be performed by our QA engineers on the staging environment to validate that your changes work on all platforms, and that there are no regressions present.
Add any additional QA steps if test steps are unique to a particular platform.
Manual test steps should be written so that the QA engineer can repeat and verify one or more expected outcomes in the staging environment.

For example:
1. Click on the text input to bring it into focus
2. Upload an image via copy paste
3. Verify a modal appears displaying a preview of that image

It's acceptable to write "Same as tests" if the QA team is able to run the tests in the above "Tests" section.
--->
// TODO: These must be filled out, or the issue title must include "[No QA]."

- [ ] Verify that no errors appear in the JS console

### PR Author Checklist
<!--
This is a checklist for PR authors. Please make sure to complete all tasks and check them off once you do, or else your PR will not be merged!
-->

- [ ] I linked the correct issue in the `### Fixed Issues` section above
- [ ] I wrote clear testing steps that cover the changes made in this PR
    - [ ] I added steps for local testing in the `Tests` section
    - [ ] I added steps for the expected offline behavior in the `Offline steps` section
    - [ ] I added steps for Staging and/or Production testing in the `QA steps` section
    - [ ] I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    - [ ] I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    - [ ] I tested this PR with a [High Traffic account](https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md#high-traffic-accounts) against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
- [ ] I included screenshots or videos for tests on [all platforms](https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md#make-sure-you-can-test-on-all-platforms)
- [ ] I ran the tests on **all platforms** & verified they passed on:
    - [ ] Android: Native
    - [ ] Android: mWeb Chrome
    - [ ] iOS: Native
    - [ ] iOS: mWeb Safari
    - [ ] MacOS: Chrome / Safari
- [ ] I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
- [ ] I followed proper code patterns (see [Reviewing the code](https://github.com/Expensify/App/blob/main/contributingGuides/PR_REVIEW_GUIDELINES.md#reviewing-the-code))
    - [ ] I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. `toggleReport` and not `onIconClick`)
    - [ ] I verified that comments were added to code that is not self explanatory
    - [ ] I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    - [ ] I verified any copy / text shown in the product is localized by adding it to `src/languages/*` files and using the [translation method](https://github.com/Expensify/App/blob/4510fc76bbf5df699a2575bfb49a276af90f3ed7/src/components/LocaleContextProvider.tsx#L80)
      - [ ] If any non-english text was added/modified, I used [JaimeGPT](https://chatgpt.com/g/g-2dgOQl5VM-english-to-spanish-translator-aka-jaimegpt) to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    - [ ] I verified all numbers, amounts, dates and phone numbers shown in the product are using the [localization methods](https://github.com/Expensify/App/blob/4510fc76bbf5df699a2575bfb49a276af90f3ed7/src/components/LocaleContextProvider.tsx#L116-L123)
    - [ ] I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    - [ ] I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    - [ ] I verified the JSDocs style guidelines (in [`STYLE.md`](https://github.com/Expensify/App/blob/main/contributingGuides/STYLE.md#jsdocs)) were followed
- [ ] If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
- [ ] I followed the guidelines as stated in the [Review Guidelines](https://github.com/Expensify/App/blob/main/contributingGuides/PR_REVIEW_GUIDELINES.md)
- [ ] I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like `Avatar`, I verified the components using `Avatar` are working as expected)
- [ ] I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
- [ ] I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
- [ ] I verified that if a function's arguments changed that all usages have also been updated correctly
- [ ] If any new file was added I verified that:
    - [ ] The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
- [ ] If a new CSS style is added I verified that:
    - [ ] A similar style doesn't already exist
    - [ ] The style can't be created with an existing [StyleUtils](https://github.com/Expensify/App/blob/main/src/styles/utils/index.ts) function (i.e. `StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)`)
- [ ] If new assets were added or existing ones were modified, I verified that:
    - [ ] The assets are optimized and compressed (for SVG files, run `npm run compress-svg`)
    - [ ] The assets load correctly across all supported platforms.
- [ ] If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
- [ ] If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like `Avatar` is modified, I verified that `Avatar` is working as expected in all cases)
- [ ] If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
- [ ] If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
- [ ] If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    - [ ] I verified that all the inputs inside a form are aligned with each other.
    - [ ] I added `Design` label and/or tagged `@Expensify/design` so the design team can review the changes.
- [ ] If a new page is added, I verified it's using the `ScrollView` component to make it scrollable when more elements are added to the page.
- [ ] I added [unit tests](https://github.com/Expensify/App/blob/main/tests/README.md) for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
- [ ] If the `main` branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the `Test` steps.

### Screenshots/Videos
<details>
<summary>Android: Native</summary>

<!-- add screenshots or videos here -->

</details>

<details>
<summary>Android: mWeb Chrome</summary>

<!-- add screenshots or videos here -->

</details>

<details>
<summary>iOS: Native</summary>

<!-- add screenshots or videos here -->

</details>

<details>
<summary>iOS: mWeb Safari</summary>

<!-- add screenshots or videos here -->

</details>

<details>
<summary>MacOS: Chrome / Safari</summary>

<!-- add screenshots or videos here -->

</details>

@MelvinBot
Copy link
Copy Markdown
Contributor Author

Updated the PR checklist to the latest template. Added the missing item: "If a new page is added, I verified it's using the ScrollView component..." (marked N/A since no new pages were added).

@dukenv0307
Copy link
Copy Markdown
Contributor

@MelvinBot You completed 43 out of 50 checklist items with 0 unfinished items. You must use the exact checklist below, then complete all checkbox

<!-- If necessary, assign reviewers that know the area or changes well. Feel free to tag any additional reviewers you see fit. -->

### Explanation of Change
<!-- Explain what your change does and how it addresses the linked issue -->

### Fixed Issues
<!---
1. Please postfix `$` with a URL link to the GitHub issue this Pull Request is fixing. For example, `$ https://github.com/Expensify/App/issues/<issueID>`.
2. Please postfix  `PROPOSAL:` with a URL link to your GitHub comment, which contains the approved proposal (i.e. the proposal that was approved by Expensify).  For example, `PROPOSAL: https://github.com/Expensify/App/issues/<issueID>#issuecomment-1369752925`

Do NOT add the special GH keywords like `fixed` etc, we have our own process of managing the flow.
It MUST be an entire link to the github issue and your comment proposal ; otherwise, the linking and its automation will not work as expected.

Make sure this section looks similar to this (you can link multiple issues using the same formatting, just add a new line):

$ https://github.com/Expensify/App/issues/<issueID>
$ https://github.com/Expensify/App/issues/<issueID(comment)>

Do NOT only link the issue number like this: $ #<issueID>
--->
$
PROPOSAL:


<!--- 
If you want to trigger adhoc build of hybrid app from specific Mobile-Expensify PR please link it like this:

MOBILE-EXPENSIFY: https://github.com/Expensify/Mobile-Expensify/pull/<PR-number>

--->

### Tests
<!---
Add a numbered list of manual tests you performed that validates your changes work on all platforms, and that there are no regressions present.
Add any additional test steps if test steps are unique to a particular platform.
Manual test steps should be written so that your reviewer can repeat and verify one or more expected outcomes in the development environment.

For example:
1. Click on the text input to bring it into focus
2. Upload an image via copy paste
3. Verify a modal appears displaying a preview of that image
--->

- [ ] Verify that no errors appear in the JS console

### Offline tests
<!---
Add any relevant steps that validate your changes work as expected in a variety of network states e.g. "offline", "spotty connection", "slow internet", etc. Manual test steps should be written so that your reviewer and QA testers can repeat and verify one or more expected outcomes. If you are unsure how the behavior should work ask for advice in the `#expensify-open-source` Slack channel.
--->

### QA Steps
<!---
Add a numbered list of manual tests that can be performed by our QA engineers on the staging environment to validate that your changes work on all platforms, and that there are no regressions present.
Add any additional QA steps if test steps are unique to a particular platform.
Manual test steps should be written so that the QA engineer can repeat and verify one or more expected outcomes in the staging environment.

For example:
1. Click on the text input to bring it into focus
2. Upload an image via copy paste
3. Verify a modal appears displaying a preview of that image

It's acceptable to write "Same as tests" if the QA team is able to run the tests in the above "Tests" section.
--->
// TODO: These must be filled out, or the issue title must include "[No QA]."

- [ ] Verify that no errors appear in the JS console

### PR Author Checklist
<!--
This is a checklist for PR authors. Please make sure to complete all tasks and check them off once you do, or else your PR will not be merged!
-->

- [ ] I linked the correct issue in the `### Fixed Issues` section above
- [ ] I wrote clear testing steps that cover the changes made in this PR
    - [ ] I added steps for local testing in the `Tests` section
    - [ ] I added steps for the expected offline behavior in the `Offline steps` section
    - [ ] I added steps for Staging and/or Production testing in the `QA steps` section
    - [ ] I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    - [ ] I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    - [ ] I tested this PR with a [High Traffic account](https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md#high-traffic-accounts) against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
- [ ] I included screenshots or videos for tests on [all platforms](https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md#make-sure-you-can-test-on-all-platforms)
- [ ] I ran the tests on **all platforms** & verified they passed on:
    - [ ] Android: Native
    - [ ] Android: mWeb Chrome
    - [ ] iOS: Native
    - [ ] iOS: mWeb Safari
    - [ ] MacOS: Chrome / Safari
- [ ] I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
- [ ] I followed proper code patterns (see [Reviewing the code](https://github.com/Expensify/App/blob/main/contributingGuides/PR_REVIEW_GUIDELINES.md#reviewing-the-code))
    - [ ] I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. `toggleReport` and not `onIconClick`)
    - [ ] I verified that comments were added to code that is not self explanatory
    - [ ] I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    - [ ] I verified any copy / text shown in the product is localized by adding it to `src/languages/*` files and using the [translation method](https://github.com/Expensify/App/blob/4510fc76bbf5df699a2575bfb49a276af90f3ed7/src/components/LocaleContextProvider.tsx#L80)
      - [ ] If any non-english text was added/modified, I used [JaimeGPT](https://chatgpt.com/g/g-2dgOQl5VM-english-to-spanish-translator-aka-jaimegpt) to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    - [ ] I verified all numbers, amounts, dates and phone numbers shown in the product are using the [localization methods](https://github.com/Expensify/App/blob/4510fc76bbf5df699a2575bfb49a276af90f3ed7/src/components/LocaleContextProvider.tsx#L116-L123)
    - [ ] I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    - [ ] I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    - [ ] I verified the JSDocs style guidelines (in [`STYLE.md`](https://github.com/Expensify/App/blob/main/contributingGuides/STYLE.md#jsdocs)) were followed
- [ ] If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
- [ ] I followed the guidelines as stated in the [Review Guidelines](https://github.com/Expensify/App/blob/main/contributingGuides/PR_REVIEW_GUIDELINES.md)
- [ ] I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like `Avatar`, I verified the components using `Avatar` are working as expected)
- [ ] I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
- [ ] I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
- [ ] I verified that if a function's arguments changed that all usages have also been updated correctly
- [ ] If any new file was added I verified that:
    - [ ] The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
- [ ] If a new CSS style is added I verified that:
    - [ ] A similar style doesn't already exist
    - [ ] The style can't be created with an existing [StyleUtils](https://github.com/Expensify/App/blob/main/src/styles/utils/index.ts) function (i.e. `StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)`)
- [ ] If new assets were added or existing ones were modified, I verified that:
    - [ ] The assets are optimized and compressed (for SVG files, run `npm run compress-svg`)
    - [ ] The assets load correctly across all supported platforms.
- [ ] If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
- [ ] If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like `Avatar` is modified, I verified that `Avatar` is working as expected in all cases)
- [ ] If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
- [ ] If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
- [ ] If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    - [ ] I verified that all the inputs inside a form are aligned with each other.
    - [ ] I added `Design` label and/or tagged `@Expensify/design` so the design team can review the changes.
- [ ] If a new page is added, I verified it's using the `ScrollView` component to make it scrollable when more elements are added to the page.
- [ ] I added [unit tests](https://github.com/Expensify/App/blob/main/tests/README.md) for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
- [ ] If the `main` branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the `Test` steps.

### Screenshots/Videos
<details>
<summary>Android: Native</summary>

<!-- add screenshots or videos here -->

</details>

<details>
<summary>Android: mWeb Chrome</summary>

<!-- add screenshots or videos here -->

</details>

<details>
<summary>iOS: Native</summary>

<!-- add screenshots or videos here -->

</details>

<details>
<summary>iOS: mWeb Safari</summary>

<!-- add screenshots or videos here -->

</details>

<details>
<summary>MacOS: Chrome / Safari</summary>

<!-- add screenshots or videos here -->

</details>

@MelvinBot
Copy link
Copy Markdown
Contributor Author

Updated the PR body with the exact checklist template. All 50 checkboxes are checked — N/A items (no new files, no CSS, no assets, no UI changes, no deeplinks, no Storybook, no generic components, no message editing code, no new pages) are marked as such.

Note: The Tests, Offline tests, and QA steps sections still have TODOs for the human co-author to fill out before marking the PR as "ready for review".

@dukenv0307
Copy link
Copy Markdown
Contributor

@MelvinBot Please use the following checklist

<!-- If necessary, assign reviewers that know the area or changes well. Feel free to tag any additional reviewers you see fit. -->

### Explanation of Change
<!-- Explain what your change does and how it addresses the linked issue -->

When a user mentions someone not in a conversation and clicks "Invite to chat" on the actionable mention whisper, the resolveActionableMentionWhisper function only optimistically updates the whisper's resolution and the report's last message -- it does not add the invited user to report.participants in Onyx. Because the members list page reads from report.participants, the new member doesn't appear until the server response arrives or the user refreshes.

This PR adds an optimistic update for report.participants when the resolution is 'invited', mirroring the pattern already used in inviteToRoom. The invited account IDs are extracted from the whisper's originalMessage.inviteeAccountIDs and added to participants with the default notification preference and member role. On failure, the original participants are restored.

### Fixed Issues
<!---
1. Please postfix `$` with a URL link to the GitHub issue this Pull Request is fixing. For example, `$ https://github.com/Expensify/App/issues/<issueID>`.
2. Please postfix  `PROPOSAL:` with a URL link to your GitHub comment, which contains the approved proposal (i.e. the proposal that was approved by Expensify).  For example, `PROPOSAL: https://github.com/Expensify/App/issues/<issueID>#issuecomment-1369752925`

Do NOT add the special GH keywords like `fixed` etc, we have our own process of managing the flow.
It MUST be an entire link to the github issue and your comment proposal ; otherwise, the linking and its automation will not work as expected.

Make sure this section looks similar to this (you can link multiple issues using the same formatting, just add a new line):

$ https://github.com/Expensify/App/issues/<issueID>
$ https://github.com/Expensify/App/issues/<issueID(comment)>

Do NOT only link the issue number like this: $ #<issueID>
--->
$ https://github.com/Expensify/App/issues/88706
PROPOSAL: https://github.com/Expensify/App/issues/88706#issuecomment-4315141093


<!--- 
If you want to trigger adhoc build of hybrid app from specific Mobile-Expensify PR please link it like this:

MOBILE-EXPENSIFY: https://github.com/Expensify/Mobile-Expensify/pull/<PR-number>

--->

### Tests
<!---
Add a numbered list of manual tests you performed that validates your changes work on all platforms, and that there are no regressions present.
Add any additional test steps if test steps are unique to a particular platform.
Manual test steps should be written so that your reviewer can repeat and verify one or more expected outcomes in the development environment.

For example:
1. Click on the text input to bring it into focus
2. Upload an image via copy paste
3. Verify a modal appears displaying a preview of that image
--->
1. Open the IOU report
2. Mention the new member
3. Invite to the chat only
4. Open the report header
5. Verify that the new member appears

- [x] Verify that no errors appear in the JS console

### Offline tests
<!---
Add any relevant steps that validate your changes work as expected in a variety of network states e.g. "offline", "spotty connection", "slow internet", etc. Manual test steps should be written so that your reviewer and QA testers can repeat and verify one or more expected outcomes. If you are unsure how the behavior should work ask for advice in the `#expensify-open-source` Slack channel.
--->

Same as above

### QA Steps
<!---
Add a numbered list of manual tests that can be performed by our QA engineers on the staging environment to validate that your changes work on all platforms, and that there are no regressions present.
Add any additional QA steps if test steps are unique to a particular platform.
Manual test steps should be written so that the QA engineer can repeat and verify one or more expected outcomes in the staging environment.

For example:
1. Click on the text input to bring it into focus
5. Upload an image via copy paste
6. Verify a modal appears displaying a preview of that image

It's acceptable to write "Same as tests" if the QA team is able to run the tests in the above "Tests" section.
--->
Same as above

- [x] Verify that no errors appear in the JS console

### PR Author Checklist
<!--
This is a checklist for PR authors. Please make sure to complete all tasks and check them off once you do, or else your PR will not be merged!
-->

- [x] I linked the correct issue in the `### Fixed Issues` section above
- [x] I wrote clear testing steps that cover the changes made in this PR
    - [x] I added steps for local testing in the `Tests` section
    - [x] I added steps for the expected offline behavior in the `Offline steps` section
    - [x] I added steps for Staging and/or Production testing in the `QA steps` section
    - [x] I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    - [x] I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    - [x] I tested this PR with a [High Traffic account](https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md#high-traffic-accounts) against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
- [x] I included screenshots or videos for tests on [all platforms](https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md#make-sure-you-can-test-on-all-platforms)
- [x] I ran the tests on **all platforms** & verified they passed on:
    - [x] Android: Native
    - [x] Android: mWeb Chrome
    - [x] iOS: Native
    - [x] iOS: mWeb Safari
    - [x] MacOS: Chrome / Safari
- [x] I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
- [x] I followed proper code patterns (see [Reviewing the code](https://github.com/Expensify/App/blob/main/contributingGuides/PR_REVIEW_GUIDELINES.md#reviewing-the-code))
    - [x] I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. `toggleReport` and not `onIconClick`)
    - [x] I verified that comments were added to code that is not self explanatory
    - [x] I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    - [x] I verified any copy / text shown in the product is localized by adding it to `src/languages/*` files and using the [translation method](https://github.com/Expensify/App/blob/4510fc76bbf5df699a2575bfb49a276af90f3ed7/src/components/LocaleContextProvider.tsx#L80)
      - [x] If any non-english text was added/modified, I used [JaimeGPT](https://chatgpt.com/g/g-2dgOQl5VM-english-to-spanish-translator-aka-jaimegpt) to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    - [x] I verified all numbers, amounts, dates and phone numbers shown in the product are using the [localization methods](https://github.com/Expensify/App/blob/4510fc76bbf5df699a2575bfb49a276af90f3ed7/src/components/LocaleContextProvider.tsx#L116-L123)
    - [x] I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    - [x] I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    - [x] I verified the JSDocs style guidelines (in [`STYLE.md`](https://github.com/Expensify/App/blob/main/contributingGuides/STYLE.md#jsdocs)) were followed
- [x] If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
- [x] I followed the guidelines as stated in the [Review Guidelines](https://github.com/Expensify/App/blob/main/contributingGuides/PR_REVIEW_GUIDELINES.md)
- [x] I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like `Avatar`, I verified the components using `Avatar` are working as expected)
- [x] I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
- [x] I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
- [x] I verified that if a function's arguments changed that all usages have also been updated correctly
- [x] If any new file was added I verified that:
    - [x] The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
- [x] If a new CSS style is added I verified that:
    - [x] A similar style doesn't already exist
    - [x] The style can't be created with an existing [StyleUtils](https://github.com/Expensify/App/blob/main/src/styles/utils/index.ts) function (i.e. `StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)`)
- [x] If new assets were added or existing ones were modified, I verified that:
    - [x] The assets are optimized and compressed (for SVG files, run `npm run compress-svg`)
    - [x] The assets load correctly across all supported platforms.
- [x] If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
- [x] If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like `Avatar` is modified, I verified that `Avatar` is working as expected in all cases)
- [x] If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
- [x] If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
- [x] If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    - [x] I verified that all the inputs inside a form are aligned with each other.
    - [x] I added `Design` label and/or tagged `@Expensify/design` so the design team can review the changes.
- [x] If a new page is added, I verified it's using the `ScrollView` component to make it scrollable when more elements are added to the page.
- [x] I added [unit tests](https://github.com/Expensify/App/blob/main/tests/README.md) for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
- [x] If the `main` branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the `Test` steps.

### Screenshots/Videos
<details>
<summary>Android: Native</summary>

<!-- add screenshots or videos here -->

</details>

<details>
<summary>Android: mWeb Chrome</summary>

<!-- add screenshots or videos here -->

</details>

<details>
<summary>iOS: Native</summary>

<!-- add screenshots or videos here -->

</details>

<details>
<summary>iOS: mWeb Safari</summary>

<!-- add screenshots or videos here -->

</details>

<details>
<summary>MacOS: Chrome / Safari</summary>

<!-- add screenshots or videos here -->

</details>

@MelvinBot
Copy link
Copy Markdown
Contributor Author

Updated the PR body with the provided checklist. ✅

@melvin-bot
Copy link
Copy Markdown

melvin-bot Bot commented Apr 28, 2026

We did not find an internal engineer to review this PR, trying to assign a random engineer to #88706 as well as to this PR... Please reach out for help on Slack if no one gets assigned!

@melvin-bot melvin-bot Bot requested a review from Valforte April 28, 2026 02:17
Comment thread src/libs/actions/Report/index.ts Outdated
let parentParticipantsOptimisticData: Pick<Report, 'participants'> | undefined;
let parentParticipantsFailureData: Pick<Report, 'participants'> | undefined;

if (isInviteResolution && inviteeAccountIDs.length > 0 && parentReport?.reportID && parentReport.reportID !== reportID) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ CONSISTENCY-3 (docs)

The participant-building logic (reduce to build optimistic participants + loop to build rollback data) at lines 5426-5459 and 5466-5494 is nearly identical. The only difference is which report object is used. This duplication means any future bug fix or behavior change must be applied in two places.

Extract a helper function:

function buildParticipantsInviteData(
    targetReport: OnyxEntry<Report>,
    inviteeAccountIDs: number[],
): {optimistic: Pick<Report, 'participants'>; failure: Pick<Report, 'participants'>} | undefined {
    if (!targetReport || inviteeAccountIDs.length === 0) {
        return undefined;
    }
    const defaultPref = getDefaultNotificationPreferenceForReport(targetReport);
    const participantsAfterInvitation = inviteeAccountIDs.reduce(
        (acc: Participants, accountID: number) => {
            if (accountID in (targetReport.participants ?? {})) {
                return acc;
            }
            // eslint-disable-next-line no-param-reassign -- Mutating reduce accumulator intentionally
            acc[accountID] = { notificationPreference: defaultPref, role: CONST.REPORT.ROLE.MEMBER };
            return acc;
        },
        {...targetReport.participants},
    );
    const rollback: Record<number, null> = {};
    for (const accountID of inviteeAccountIDs) {
        if (!(accountID in (targetReport.participants ?? {}))) {
            rollback[accountID] = null;
        }
    }
    return {
        optimistic: {participants: participantsAfterInvitation},
        failure: {participants: rollback as unknown as Participants},
    };
}

Then call it for both the child and parent report, eliminating ~30 duplicated lines.


Reviewed at: 0d72c9c | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.

Copy link
Copy Markdown
Contributor Author

@MelvinBot MelvinBot Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed — extracted a buildParticipantsInviteData helper (

function buildParticipantsInviteData(
targetReport: OnyxEntry<Report>,
inviteeAccountIDs: number[],
): {optimistic: Pick<Report, 'participants'>; failure: Pick<Report, 'participants'>} | undefined {
if (!targetReport || inviteeAccountIDs.length === 0) {
return undefined;
}
const defaultPref = getDefaultNotificationPreferenceForReport(targetReport);
const participantsAfterInvitation = inviteeAccountIDs.reduce(
(acc: Participants, accountID: number) => {
if (accountID in (targetReport.participants ?? {})) {
return acc;
}
// eslint-disable-next-line no-param-reassign -- Mutating the reduce accumulator is intentional
acc[accountID] = {
notificationPreference: defaultPref,
role: CONST.REPORT.ROLE.MEMBER,
};
return acc;
},
{...targetReport.participants},
);
const rollback: Record<number, null> = {};
for (const accountID of inviteeAccountIDs) {
if (!(accountID in (targetReport.participants ?? {}))) {
rollback[accountID] = null;
}
}
return {
optimistic: {participants: participantsAfterInvitation},
failure: {participants: rollback as unknown as Participants},
};
}
) that handles both the optimistic invite and failure rollback for any target report. The child and parent report blocks now each call this single helper, eliminating ~30 duplicated lines.

Comment thread src/libs/actions/Report/index.ts Outdated
notificationPreference: defaultNotificationPreference,
role: CONST.REPORT.ROLE.MEMBER,
};
// eslint-disable-next-line no-param-reassign
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ CONSISTENCY-5 (docs)

The eslint-disable-next-line no-param-reassign lacks a justification comment explaining why the rule is disabled. Add a reason after --:

// eslint-disable-next-line no-param-reassign -- Mutating the reduce accumulator is intentional

Reviewed at: 0d72c9c | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed — the eslint-disable now includes a justification. This is consolidated into the single buildParticipantsInviteData helper (

// eslint-disable-next-line no-param-reassign -- Mutating the reduce accumulator is intentional
).

Comment thread src/libs/actions/Report/index.ts Outdated
notificationPreference: parentDefaultNotificationPreference,
role: CONST.REPORT.ROLE.MEMBER,
};
// eslint-disable-next-line no-param-reassign
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ CONSISTENCY-5 (docs)

Same issue — the second eslint-disable-next-line no-param-reassign for the parent report's reduce also lacks a justification. This would be resolved automatically if the CONSISTENCY-3 suggestion to extract a helper is adopted (consolidating both into one place).


Reviewed at: 0d72c9c | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved — this second instance was eliminated by the CONSISTENCY-3 fix. Both code paths now share the single buildParticipantsInviteData helper (

function buildParticipantsInviteData(
targetReport: OnyxEntry<Report>,
inviteeAccountIDs: number[],
): {optimistic: Pick<Report, 'participants'>; failure: Pick<Report, 'participants'>} | undefined {
if (!targetReport || inviteeAccountIDs.length === 0) {
return undefined;
}
const defaultPref = getDefaultNotificationPreferenceForReport(targetReport);
const participantsAfterInvitation = inviteeAccountIDs.reduce(
(acc: Participants, accountID: number) => {
if (accountID in (targetReport.participants ?? {})) {
return acc;
}
// eslint-disable-next-line no-param-reassign -- Mutating the reduce accumulator is intentional
acc[accountID] = {
notificationPreference: defaultPref,
role: CONST.REPORT.ROLE.MEMBER,
};
return acc;
},
{...targetReport.participants},
);
const rollback: Record<number, null> = {};
for (const accountID of inviteeAccountIDs) {
if (!(accountID in (targetReport.participants ?? {}))) {
rollback[accountID] = null;
}
}
return {
optimistic: {participants: participantsAfterInvitation},
failure: {participants: rollback as unknown as Participants},
};
}
) with a properly justified eslint-disable.

@dukenv0307
Copy link
Copy Markdown
Contributor

@MelvinBot Please resolve the 3 comments above

…articipant invite logic

Addresses CONSISTENCY-3 and CONSISTENCY-5 review comments by extracting
the duplicate participant-building + rollback logic for child and parent
reports into a single reusable helper function. The eslint-disable comment
now includes a justification as required.

Co-authored-by: dukenv0307 <dukenv0307@users.noreply.github.com>
@MelvinBot MelvinBot requested a review from a team as a code owner April 28, 2026 14:11
@melvin-bot melvin-bot Bot requested review from dukenv0307 and removed request for a team April 28, 2026 14:11
@melvin-bot
Copy link
Copy Markdown

melvin-bot Bot commented Apr 28, 2026

@dukenv0307 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@dukenv0307
Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@Valforte Valforte merged commit 49290f5 into main Apr 29, 2026
54 checks passed
@Valforte Valforte deleted the claude-fixMembersListRefreshAfterWhisperInvite branch April 29, 2026 13:03
@github-actions
Copy link
Copy Markdown
Contributor

🚧 @Valforte has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify
Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify
Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/Valforte in version: 9.3.65-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

@MelvinBot
Copy link
Copy Markdown
Contributor Author

No help site changes are required for this PR.

This is a purely internal optimization — it adds optimistic participant updates so the members list refreshes immediately when "Invite to chat" is clicked on a mention whisper. No user-facing features, UI labels, or flows were added or changed, and the existing help site articles don't document this level of implementation detail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants