Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[$250] Create Expense - Deeplinking expense creation leads to an expense with 0 amount #56752

Open
4 of 8 tasks
IuliiaHerets opened this issue Feb 12, 2025 · 10 comments
Open
4 of 8 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@IuliiaHerets
Copy link

IuliiaHerets commented Feb 12, 2025

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 9.0.97-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: #55384
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team
Device used: Windows 10/ Chrome, Samsung Galaxy A12/Android 13
App Component: Money Requests

Action Performed:

Precondition: On Web or mWeb, submit an expense but stop at the Confirm Details page, copy and send the URL to a chat.

  1. Log in to the account with access to the URL in the conversation
  2. Tap the link
  3. Enter the amount and tap the next
  4. In Confirm Details page, tab the back arrow until you are back to the conversation
  5. Tap the link again

Expected Result:

User is directed to a new Submit Expense flow.

Actual Result:

User is directed the Confirm Details page, with 0 amount, and no field to choose participant.

Workaround:

Unknown

Platforms:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6740538_1739358077888.az_recorder_20250212_134025.1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021892129400309534836
  • Upwork Job ID: 1892129400309534836
  • Last Price Increase: 2025-02-19
Issue OwnerCurrent Issue Owner: @mananjadhav
@IuliiaHerets IuliiaHerets added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 labels Feb 12, 2025
Copy link

melvin-bot bot commented Feb 12, 2025

Triggered auto assignment to @sonialiap (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

Copy link

melvin-bot bot commented Feb 18, 2025

@sonialiap Huh... This is 4 days overdue. Who can take care of this?

@sonialiap sonialiap added the External Added to denote the issue can be worked on by a contributor label Feb 19, 2025
@melvin-bot melvin-bot bot changed the title Create Expense - Deeplinking expense creation leads to an expense with 0 amount [$250] Create Expense - Deeplinking expense creation leads to an expense with 0 amount Feb 19, 2025
Copy link

melvin-bot bot commented Feb 19, 2025

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 19, 2025
Copy link

melvin-bot bot commented Feb 19, 2025

Triggered auto assignment to Contributor-plus team member for initial proposal review - @mananjadhav (External)

@melvin-bot melvin-bot bot removed the Overdue label Feb 19, 2025
@sonialiap sonialiap moved this to Bugs and Follow Up Issues in [#whatsnext] #expense Feb 19, 2025
@nkdengineer
Copy link
Contributor

Proposal

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

User is directed the Confirm Details page, with 0 amount, and no field to choose participant.

What is the root cause of that problem?

When we first access the deep link, this useEffect will move the user to the new submit flow because the transaction data doesn't exist.

useEffect(() => {
if (!!isLoadingTransaction || (transaction?.transactionID && (!transaction?.isFromGlobalCreate || !isEmptyObject(transaction?.participants)))) {
return;
}
startMoneyRequest(
CONST.IOU.TYPE.CREATE,
// When starting to create an expense from the global FAB, there is not an existing report yet. A random optimistic reportID is generated and used
// for all of the routes in the creation flow.
generateReportID(),

After we complete the flow at the confirmation step and close the flow, the transaction draft isn't cleared then after we access the URL again, the useEffect above returns early because the transaction data exists.

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

We also need to compare the reportID of participant and the reportID in the URL to check if it's valid or not. The reportID is correct if it matches with the transaction.reportID in the case it's not the global create or it matches with reportID of the participant (existing report) / matches with transaction?.reportID (random reportID) in the case global create.

useEffect(() => {
    const isCurrentReportID = transaction?.isFromGlobalCreate
            ? transaction?.participants?.at(0)?.reportID === reportID || (!transaction?.participants?.at(0)?.reportID && transaction?.reportID === reportID)
            : transaction?.reportID === reportID;
    if (!!isLoadingTransaction || (transaction?.transactionID && (!transaction?.isFromGlobalCreate || !isEmptyObject(transaction?.participants)) && isCurrentReportID)) {
        return;
    }
    startMoneyRequest(
        CONST.IOU.TYPE.CREATE,
        // When starting to create an expense from the global FAB, there is not an existing report yet. A random optimistic reportID is generated and used
        // for all of the routes in the creation flow.
        generateReportID(),
    );
    // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps -- we don't want this effect to run again
}, [isLoadingTransaction, reportID]);

useEffect(() => {
if (!!isLoadingTransaction || (transaction?.transactionID && (!transaction?.isFromGlobalCreate || !isEmptyObject(transaction?.participants)))) {
return;
}
startMoneyRequest(
CONST.IOU.TYPE.CREATE,
// When starting to create an expense from the global FAB, there is not an existing report yet. A random optimistic reportID is generated and used
// for all of the routes in the creation flow.
generateReportID(),

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

None

What alternative solutions did you explore? (Optional)

When we close any step in the flow, we can clear the transaction draft data if we're creating a new transaction by using clearMoneyRequest function.

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

Copy link

melvin-bot bot commented Feb 24, 2025

@mananjadhav, @sonialiap Huh... This is 4 days overdue. Who can take care of this?

@melvin-bot melvin-bot bot added the Overdue label Feb 24, 2025
@mananjadhav
Copy link
Collaborator

@nkdengineer's proposal looks good to me.

🎀 👀 🎀 C+ reviewed

@melvin-bot melvin-bot bot removed the Overdue label Feb 25, 2025
Copy link

melvin-bot bot commented Feb 25, 2025

Triggered auto assignment to @cead22, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

Copy link

melvin-bot bot commented Feb 26, 2025

@cead22 @mananjadhav @sonialiap this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@mananjadhav
Copy link
Collaborator

Quick bump @cead22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
Status: Bugs and Follow Up Issues
Development

No branches or pull requests

5 participants