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

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

Closed
1 of 6 tasks
lanitochka17 opened this issue Aug 24, 2023 · 14 comments
Closed
1 of 6 tasks

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

lanitochka17 opened this issue Aug 24, 2023 · 14 comments
Assignees

Comments

@lanitochka17
Copy link

lanitochka17 commented Aug 24, 2023

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

@lanitochka17 lanitochka17 added the DeployBlockerCash This issue or pull request should block deployment label Aug 24, 2023
@OSBotify
Copy link
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.

@melvin-bot
Copy link

melvin-bot bot commented Aug 24, 2023

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

@pradeepmdk
Copy link
Contributor

pradeepmdk commented Aug 24, 2023

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;
    }

@Nathan-Mulugeta
Copy link

Nathan-Mulugeta commented Aug 24, 2023

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.

@amyevans
Copy link
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?

@amyevans amyevans added Hourly KSv2 and removed Daily KSv2 labels Aug 24, 2023
@pradeepmdk
Copy link
Contributor

pradeepmdk commented Aug 24, 2023

@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.

@pradeepmdk
Copy link
Contributor

pradeepmdk commented Aug 24, 2023

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.

@mountiny
Copy link
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

@pradeepmdk
Copy link
Contributor

pradeepmdk commented Aug 24, 2023

@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

@roryabraham
Copy link
Contributor

@Pujan92
Copy link
Contributor

Pujan92 commented Aug 24, 2023

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

@amyevans
Copy link
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 😅

@roryabraham
Copy link
Contributor

Confirmed, no longer reproducible.

@melvin-bot
Copy link

melvin-bot bot commented Sep 3, 2023

⚠️ 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
Projects
None yet
Development

No branches or pull requests

8 participants