Skip to content

Stop creating the transaction thread reports optimistically for RequestMoney - #63931

Merged
iwiznia merged 44 commits into
Expensify:mainfrom
callstack-internal:VickyStash/feature/58828-stop-creating-optimistic-transaction-4
Jul 30, 2025
Merged

Stop creating the transaction thread reports optimistically for RequestMoney#63931
iwiznia merged 44 commits into
Expensify:mainfrom
callstack-internal:VickyStash/feature/58828-stop-creating-optimistic-transaction-4

Conversation

@VickyStash

@VickyStash VickyStash commented Jun 11, 2025

Copy link
Copy Markdown
Contributor

Explanation of Change

Re-apply changes of reverted PR: #62080

Regressions reported previous time:
#63490
#63461
#63470
#63511
#63509
#63493

Fixed Issues

$ #58828
PROPOSAL: N/A

Tests

  • Verify that no errors appear in the JS console

Basic testing:

  1. Open a new 1-1 chat.
  2. One transaction thread expense case:
    2.1 In the chat tap FAB -> Create expense. Go through the steps and create a manual expense. It will be the first expense in this 1-1 chat.
    2.2 Check that the RequestMoney API call didn't create a transaction thread report.
    2.3 Tap on the expense -> the transaction thread report should be created and opened.
  3. Create a couple more expenses in the same chat.
  4. Try to open any expense and see that the transaction thread report is created and opened.

Complex testing:

Test different flows related to expenses and transaction threads overview, including:

  • opening threads offline
  • opening threads after data reset
  • putting expenses on hold
  • deleting expenses
  • open threads from Reports -> Expenses, Reports -> Reports viewers.

Regressions:

Please, make sure regressions are fixed.

1. When expense has Concierge message, transaction thread with RBR appears in LHN after app reset

See steps in #63490

2. Reports - Individual expense row opens expense report instead of transaction thread

See steps in #63461

3. Reports - Expense report loads infinitely after reset app

See steps in #63470

4. After moving expense to self DM, expense thread loads infinitely with empty header when offline

See steps in #63511

5. Duplicate expenses - Expense appears twice after keeping one of the duplicates

See steps in #63509

6. Expense - Combined report is not opened when the expense report is with Manager McTest

See steps in #63493

Offline tests

Same, as in the Tests section

QA Steps

// TODO: These must be filled out, or the issue title must include "[No QA]."

  • Verify that no errors appear in the JS console

Same, as in the Tests section

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
    • MacOS: Desktop
  • 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 verified there are no new alerts related to the canBeMissing param for useOnyx
  • 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 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.mp4
Android: mWeb Chrome
android_web.mp4
iOS: Native
ios.mp4
iOS: mWeb Safari
ios_web.mp4
MacOS: Chrome / Safari
basic_testing.mp4
1-regression.mp4
2-regression.mp4
3-regression.mp4
4-regression.mp4
5-regression.mp4
6-regression.mp4
MacOS: Desktop
desktop.mp4

…ckyStash/revert-pr-62080"

This reverts commit 88db369, reversing
changes made to 6d5a2a6.
@VickyStash VickyStash changed the title Stop creating the transaction thread reports optimistically for RequestMoney [WIP] Stop creating the transaction thread reports optimistically for RequestMoney Jun 11, 2025
…ating-optimistic-transaction-4

# Conflicts:
#	src/pages/home/ReportScreen.tsx
#	src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx
…ating-optimistic-transaction-4

# Conflicts:
#	src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx
#	src/components/SelectionList/Search/ReportListItem.tsx
…ows if threads are not created optimistically
…tion arrows if threads are not created optimistically"

This reverts commit d7e218e.
…istic-transaction-4

# Conflicts:
#	src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx
#	src/components/SelectionList/Search/ReportListItem.tsx
#	src/libs/ReportUtils.ts
#	src/libs/actions/IOU.ts
…istic-transaction-4

# Conflicts:
#	src/components/MoneyReportHeader.tsx
#	src/components/Search/index.tsx
#	src/components/SelectionList/Search/TransactionGroupListItem.tsx
#	src/libs/ReportUtils.ts
#	src/pages/Search/SearchMoneyRequestReportPage.tsx
…istic-transaction-4

# Conflicts:
#	src/pages/Search/SearchMoneyRequestReportPage.tsx
@VickyStash VickyStash changed the title [WIP] Stop creating the transaction thread reports optimistically for RequestMoney [HOLD] Stop creating the transaction thread reports optimistically for RequestMoney Jun 27, 2025
@VickyStash

Copy link
Copy Markdown
Contributor Author

@hungvu193 @iwiznia

Previously reported regressions:

#63490 Fixed in 38f53b8
#63461 Fixed in feee8b8
#63470 Fixed in f27a2d5 and 1f5c8f4
#63511 - not reproducible
#63509 - Fixed in 38f53b8, BUT due to performance risks of this solution, we will add a BE fix and revert this one, so while we waiting for the BE fix the PR is ON HOLD
#63493 - Fixed in #63546, 5445d00

I've retested the PR and added the recordings.
In the WEB recordings you can find every regression scenario separately.

I'll be OOO next week (June 30 - July 4) 🌴
@hungvu193 Since testing of this PR is pretty massive, it would be great if you could start during this time!

@VickyStash
VickyStash marked this pull request as ready for review June 27, 2025 14:08
@VickyStash
VickyStash requested a review from a team as a code owner June 27, 2025 14:08
@melvin-bot
melvin-bot Bot requested review from hungvu193 and removed request for a team June 27, 2025 14:08
@iwiznia
iwiznia merged commit 7208e29 into Expensify:main Jul 30, 2025
19 checks passed
@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.

Comment thread src/libs/actions/IOU.ts
params.createdReportActionIDForThread = optimisticCreatedAction.reportActionID;
}

API.write('HoldRequest', params, {optimisticData, successData, failureData});

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.

@VickyStash From the diff, I can see you are not the original one to blame for this, but since you are the last one that touched this, can you please make a quick PR to ensure this is referencing the constant HOLD_MONEY_REQUEST?

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.

Looks like the same thing happened to 'UnHoldRequest' as well

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.

Yes. It came from #33897

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.

Anyway, I created a PR here:
#67474

cc @iwiznia

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.

Oh sorry for this, should've caught it.

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/iwiznia in version: 9.1.88-0 🚀

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

@Julesssss

Copy link
Copy Markdown
Contributor

Hey all, an App regression occurred in the current release where LHN reports are named Chat Report when creating chats and then signing out and back in: #67596.

I'm not certain but it seems related to the optimistic report thread changes that are linked to this issue. Please could you take a look, thanks.

@VickyStash

Copy link
Copy Markdown
Contributor Author

@hungvu193 @iwiznia FYI I'm looking through all of the reported deploy blockers to define which of them can be caused by this PR.
For now I've found one: #67590

@hungvu193

Copy link
Copy Markdown
Contributor

@VickyStash Thank you. Do you have solution for it?

Sorry, my dev env's broken so I couldn't help much

@mjasikowski

Copy link
Copy Markdown
Contributor

@VickyStash another one caused by this PR: #67588

@VickyStash

VickyStash commented Aug 1, 2025

Copy link
Copy Markdown
Contributor Author

Updated list of regressions:
#67590
#67588
#67593
#67622
#67589

@VickyStash VickyStash mentioned this pull request Aug 1, 2025
51 tasks
@iwiznia

iwiznia commented Aug 1, 2025

Copy link
Copy Markdown
Contributor

Damn, this seems to never end. Should we revert this or are you fixing the issues with a new PR to CP?

@VickyStash

Copy link
Copy Markdown
Contributor Author

Damn, this seems to never end. Should we revert this or are you fixing the issues with a new PR to CP?

I'll try to prepare a PR, let's see how it goes.
But if there is one more revert, we need to change our approach and divide the work into pieces.

@github-actions

github-actions Bot commented Aug 4, 2025

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/grgia in version: 9.1.88-3 🚀

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

@github-actions

github-actions Bot commented Aug 4, 2025

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/iwiznia in version: 9.1.89-1 🚀

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

@github-actions

github-actions Bot commented Aug 6, 2025

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/jasperhuangg in version: 9.1.89-21 🚀

platform result
🖥 desktop 🖥 success ✅
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 failure ❌

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants