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

[HOLD for PR #18997] Chat - Infinite loading after opening attached image a few times #24067

Open
1 of 6 tasks
lanitochka17 opened this issue Aug 2, 2023 · 50 comments
Open
1 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Monthly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Aug 2, 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!


Action Performed:

  1. Open the app
  2. Open any chat
  3. Tap the "+" button and select "Add attachment" > "Choose from gallery"
  4. Select any image and tap "Send"
  5. Open the image and close it a few times

Expected Result:

The image preview is shown every time

Actual Result:

Infinite loading after opening the image preview a few times. The same behavior when opening images from old chats

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.49.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:

Email or phone of affected tester (no customers):

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

Notes/Photos/Videos: Any additional supporting documentation

Bug6150602_Video_2023-08-02_12-10-52-1.mp4

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team

Slack conversation:

View all open jobs on GitHub

@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 2, 2023

Triggered auto assignment to @garrettmknight (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Aug 2, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@honnamkuan
Copy link
Contributor

Proposal

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

When image attachment is opened several times in Native apps, sometimes the loading icon is shown forever and the image preview does not load.

What is the root cause of that problem?

In ImageView (index.native.js), we have callback function logics to set
isLoading: true in onLoadStart callback; and
isLoading: false in onLoad callback;

see:

onLoadStart={this.imageLoadingStart}
onLoad={this.configureImageZoom}

That works well when it is the first time the image is being opened, onLoadStart get called first when loading start, and onLoad get called later when loading ends.

However, when an image is being opened more than once, it is already cached, so technically the image does not need to be loaded anymore, onLoadStart and onLoad callbacks actually fires at the same time in these cases.
Sometimes onLoadStart fires first, and we have no problem.
Other times, onLoad fires first, followed by onLoadStart, in this scenario, isLoading state is set to false and then true, thus the loading icon is shown forever instead of image preview.

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

We actually do not need to configure onLoadStart callback, as its purpose is to resetImageZoom whenever the source image URL changes.
That is already handled via componentDidUpdate component lifecycle function, which is already calling resetImageZoom whenever the URL changes.

componentDidUpdate(prevProps) {
if (this.props.url === prevProps.url) {
return;
}
this.imageLoadingStart();

To resolve the issue, we should unset onLoadStart by removing this line

onLoadStart={this.imageLoadingStart}

What alternative solutions did you explore? (Optional)

If the indeterministic firing sequence of onLoadStart and onLoad when image does not requires loading (when already cached) is considered as a bug in upstream library react-native-fast-image, then we can also choose to submit a PR fix upstream.

@gadhiyamanan
Copy link
Contributor

might be same root cause #22920

@garrettmknight
Copy link
Contributor

@gadhiyamanan agreed, I think this looks like the same root cause. Let's put this on hold and leave this open until this PR is deployed. I'll retest and see if that fixed it.

@garrettmknight garrettmknight added Weekly KSv2 and removed Daily KSv2 labels Aug 3, 2023
@garrettmknight garrettmknight changed the title Chat - Infinite loading after opening attached image a few times [Held on PR #18997] Chat - Infinite loading after opening attached image a few times Aug 3, 2023
@garrettmknight garrettmknight changed the title [Held on PR #18997] Chat - Infinite loading after opening attached image a few times [HOLD for PR #18997] Chat - Infinite loading after opening attached image a few times Aug 3, 2023
@garrettmknight
Copy link
Contributor

Still holding

@melvin-bot melvin-bot bot added the Overdue label Aug 21, 2023
@garrettmknight
Copy link
Contributor

Still holding

@melvin-bot melvin-bot bot removed the Overdue label Aug 21, 2023
@melvin-bot melvin-bot bot added the Overdue label Aug 30, 2023
@garrettmknight
Copy link
Contributor

Still holding

@melvin-bot melvin-bot bot removed the Overdue label Aug 30, 2023
@melvin-bot melvin-bot bot added the Overdue label Sep 11, 2023
@garrettmknight
Copy link
Contributor

Still holding

@melvin-bot melvin-bot bot removed the Overdue label Sep 11, 2023
@melvin-bot melvin-bot bot added the Overdue label Sep 20, 2023
@garrettmknight
Copy link
Contributor

Still holding

@melvin-bot melvin-bot bot removed the Overdue label Sep 21, 2023
@melvin-bot melvin-bot bot added the Overdue label Sep 29, 2023
@garrettmknight
Copy link
Contributor

Still holding on #18997

@melvin-bot melvin-bot bot removed the Overdue label Oct 3, 2023
@melvin-bot melvin-bot bot added the Overdue label Oct 12, 2023
@garrettmknight
Copy link
Contributor

Still holding on #18997

@garrettmknight
Copy link
Contributor

Still holding on #18997

@melvin-bot melvin-bot bot added the Overdue label Jun 10, 2024
@garrettmknight
Copy link
Contributor

Still holding on #18997

@melvin-bot melvin-bot bot removed the Overdue label Jun 10, 2024
@garrettmknight
Copy link
Contributor

Still holding on #18997

@melvin-bot melvin-bot bot added the Overdue label Jun 25, 2024
@garrettmknight
Copy link
Contributor

Still holding on #18997

@melvin-bot melvin-bot bot removed the Overdue label Jun 28, 2024
@melvin-bot melvin-bot bot added the Overdue label Jul 8, 2024
@garrettmknight
Copy link
Contributor

Still holding on #18997

@melvin-bot melvin-bot bot removed the Overdue label Jul 8, 2024
@melvin-bot melvin-bot bot added the Overdue label Jul 16, 2024
@garrettmknight
Copy link
Contributor

Still holding on #18997

@melvin-bot melvin-bot bot removed the Overdue label Jul 17, 2024
@melvin-bot melvin-bot bot added the Overdue label Jul 25, 2024
@garrettmknight
Copy link
Contributor

Still holding

@melvin-bot melvin-bot bot removed the Overdue label Jul 31, 2024
@melvin-bot melvin-bot bot added the Overdue label Aug 8, 2024
@garrettmknight
Copy link
Contributor

Still holding on #18997

@melvin-bot melvin-bot bot removed the Overdue label Aug 9, 2024
@melvin-bot melvin-bot bot added the Overdue label Aug 19, 2024
@garrettmknight
Copy link
Contributor

Still holding on #18997

@melvin-bot melvin-bot bot removed the Overdue label Aug 20, 2024
@garrettmknight
Copy link
Contributor

Still holding on #18997

1 similar comment
@garrettmknight
Copy link
Contributor

Still holding on #18997

@garrettmknight garrettmknight added Monthly KSv2 and removed Weekly KSv2 labels Sep 3, 2024
@melvin-bot melvin-bot bot added the Overdue label Oct 4, 2024
@garrettmknight
Copy link
Contributor

Still holding on #18997

@melvin-bot melvin-bot bot removed the Overdue label Oct 9, 2024
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. Monthly KSv2
Projects
None yet
Development

No branches or pull requests

4 participants