Skip to content

Android - Request money - App crashes when editing Amount twice #25841

Closed

Description

@lanitochka17

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Issue found when executing PR #24630

Action Performed:

  1. Launch New Expensify app
  2. Request money from other user
  3. Tap on the IOU preview twice
  4. Edit the amount twice

Expected Result:

App does not crash

Actual Result:

App crashes

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.57-0

Reproducible in staging?: Yes

Reproducible in production?: No

If this was caught during regression testing, add the test name, ID and link from TestRail:

Email or phone of affected tester (no customers):

Logs: https://stackoverflow.com/c/expensify/questions/4856

Notes/Photos/Videos: Any additional supporting documentation

Bug6175499_Screen_Recording_20230824_195139_One_UI_Home.mp4

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team

Slack conversation:

View all open jobs on GitHub

Activity

  1. OSBotify commented on Aug 24, 2023

    @OSBotify
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open StagingDeployCash deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  2. melvin-bot commented on Aug 24, 2023

    @melvin-bot

    Triggered auto assignment to @amyevans (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

  3. pradeepmdk commented on Aug 24, 2023

    @pradeepmdk
    Contributor

    Proposal

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

    Android - Request money - App crashes when editing Amount twice

    What is the root cause of that problem?

    Screenshot 2023-08-24 at 7 33 27 PM


    uri doest not support local image
    this pr is enabled this feature
    https://github.com/Expensify/App/pull/24235/files
    when first time editMoneyRequest called we are getting with receipt so that on second time we are setting as open in optimastic data so at the time has receipt is there and open the <ReportActionItemImage /> and we are trying to show the image ..so at the time we are passing wrong source param and app is broken
    if (shouldStopSmartscan && _.has(transaction, 'receipt') && !_.isEmpty(transaction.receipt) && lodashGet(transaction, 'receipt.state') !== CONST.IOU.RECEIPT_STATE.OPEN) {
    updatedTransaction.receipt.state = CONST.IOU.RECEIPT_STATE.OPEN;
    }

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

    here in ReportActionItemImage uri will doesn't support local assets file path.

     return (
            <Image
                source={{uri: image}}
                style={[styles.w100, styles.h100]}
            />
        );
    

    so we need 'ReportActionItemImage' one more props if we are trying to load assets image means

     return (
            <Image
                source={assets ?  assets : {uri: image}}
                style={[styles.w100, styles.h100]}
            />
        );
    

    and this function should return getThumbnailAndImageURIs {thumbnail: null, image: null , assets: localImagepath};

    and
    here we should OPEN only receipt.state not empty and not open on editMoneyRequest api

     if (shouldStopSmartscan && _.has(transaction, 'receipt') && !_.isEmpty(transaction.receipt) && !_.isEmpty(lodashGet(transaction, 'receipt.state')) && lodashGet(transaction, 'receipt.state') !== CONST.IOU.RECEIPT_STATE.OPEN) {
            updatedTransaction.receipt.state = CONST.IOU.RECEIPT_STATE.OPEN;
        }
  4. Nathan-Mulugeta commented on Aug 24, 2023

    @Nathan-Mulugeta

    Hey guys I think this bug report might have the same root cause as the one I have reported. And my report came first here on slack.

  5. amyevans commented on Aug 24, 2023

    @amyevans
    Contributor

    @pradeepmdk I don't think I'm following your proposal. The <ReportActionItemImage /> component is only used if the transaction has a receipt, and the bug video shows that it is a cash request.

    If it does have something to do with that PR, the PR has already deployed to production, so this wouldn't be a deploy blocker. @lanitochka17 could you try to reproduce the issue on production again and confirm for me if it crashes or not?

  6. added and removed on Aug 24, 2023
  7. pradeepmdk commented on Aug 24, 2023

    @pradeepmdk
    Contributor

    @amyevans I agree is shown only when have 'receipt', but when editMoneyRequest called first time its return the receipt data so that its start occurring from second time

     if (shouldStopSmartscan && _.has(transaction, 'receipt') && !_.isEmpty(transaction.receipt) && lodashGet(transaction, 'receipt.state') !== CONST.IOU.RECEIPT_STATE.OPEN) {
            updatedTransaction.receipt.state = CONST.IOU.RECEIPT_STATE.OPEN;
        }
    

    at the time ReportActionItemImage is showing.

    const updatedTransaction = TransactionUtils.getUpdatedTransaction(transaction, transactionChanges, isFromExpenseReport);

    but when hasReceipt we are calling this and get the image on the image we are returning the local assets images

     ReceiptUtils.getThumbnailAndImageURIs(transaction.receipt.source, transaction.filename);
    inside the function
     let image = ReceiptGeneric;
        if (fileExtension === CONST.IOU.FILE_TYPES.HTML) {
            image = ReceiptHTML;
        }
    
        if (fileExtension === CONST.IOU.FILE_TYPES.DOC || fileExtension === CONST.IOU.FILE_TYPES.DOCX) {
            image = ReceiptDoc;
        }
    
        if (fileExtension === CONST.IOU.FILE_TYPES.SVG) {
            image = ReceiptSVG;
        }
        return {thumbnail: null, image};
    

    local assets image when we import its has a reference number not a actual path
    on that refrence should be passed source={image} but we are passing into source={{uri: image}} so that app is crashed.

  8. pradeepmdk commented on Aug 24, 2023

    @pradeepmdk
    Contributor

    Screenshot 2023-08-24 at 9 29 48 PM
    for BE:
    For this first point has 'receipt' editMoneyRequest should not return the when receipt.state is empty.
    for FE:
    we should check here receipt.state should not be an empty when for open
    if (shouldStopSmartscan && _.has(transaction, 'receipt') && !_.isEmpty(transaction.receipt) && lodashGet(transaction, 'receipt.state') !== CONST.IOU.RECEIPT_STATE.OPEN) {

    and for this crash part source={assets ? assets : {uri: image}}. uri will apply for blob or file . so that its should not crash is when receipt data as well.

  9. mountiny commented on Aug 24, 2023

    @mountiny
    Contributor

    editMoneyRequest called first time its return the receipt data so that its start occurring from second time

    @amyevans fyi this will be fixed with the next auth deploy happening real soon I think https://github.com/Expensify/Auth/pull/8562

    So maybe we can just wait

  10. pradeepmdk commented on Aug 24, 2023

    @pradeepmdk
    Contributor

    @mountiny still we have an issue with loading images from local assets getThumbnailAndImageURIs

    let image = ReceiptGeneric;

    Local assets should be passed to without uri
    And this function should return if we have http url

  11. roryabraham commented on Aug 24, 2023

    @roryabraham
    Contributor
  12. Pujan92 commented on Aug 24, 2023

    @Pujan92
    Contributor

    I think not reproducible now as the receipt state is not updated unnecessarily when the request type is not scan.

  13. amyevans commented on Aug 24, 2023

    @amyevans
    Contributor

    Cool, @roryabraham mind confirming the issue is no longer reproducible? My Android build is hosed at the moment, trying to get that going again but in the meantime I can't test 😅

  14. roryabraham commented on Aug 24, 2023

    @roryabraham
    Contributor

    Confirmed, no longer reproducible.

  15. melvin-bot commented on Sep 3, 2023

    @melvin-bot

    ⚠️ Looks like this issue was linked to a Deploy Blocker here

    If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

    If a regression has occurred and you are the assigned CM follow the instructions here.

    If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions