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 payment 2023-03-09] [$1000] GIF attachments are either displayed as blank or there is infinite loading on attachment preview #15288

Closed
1 task
kavimuru opened this issue Feb 19, 2023 · 68 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review

Comments

@kavimuru
Copy link

kavimuru commented Feb 19, 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 and login with user A
  2. Open user B report
  3. Send any gif
  4. Open the app in android and login with user B
  5. Open user A report
  6. Click on gif to preview the gif

Expected Result:

GIF should be displayed normally on preview screen

Actual Result:

Most of times, blank screen or infinite loading is displayed for GIF preview

Workaround:

unknown

Platforms:

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

  • Android / native

Version Number: 1.2.74-0
Reproducible in staging?: y
Reproducible in production?: y
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:

gif.attachments.issue.mp4
az_recorder_20230219_155008.1.mp4

Expensify/Expensify Issue URL:
Issue reported by: @dhanashree-sawant
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1676741569824349

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~018f1c677402b17651
  • Upwork Job ID: 1627995019837296640
  • Last Price Increase: 2023-02-21
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Feb 19, 2023
@melvin-bot melvin-bot bot locked and limited conversation to collaborators Feb 19, 2023
@MelvinBot
Copy link

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

@MelvinBot
Copy link

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

@JmillsExpensify
Copy link

cc @Beamanator @trjExpensify Might want to fold this into image iprovements.

@trjExpensify
Copy link
Contributor

Hm yeah, is this not a dupe? #14751 the PR was approved today?

@Beamanator
Copy link
Contributor

Not quite dupes, #14751 is only about uploading a gif as an avatar, not a chat attachment

@trjExpensify
Copy link
Contributor

Gotcha, okay. This is inconsistently reproducible on browserstack:

Lmd0Wmrw9i

oHpV9BBFso

I asked @Julesssss to try on a physical Android device for good measure, and he's equally getting inconsistent results.

Seems like something we should investigate further. @thomas-coldwell you might have an idea from the image caching improvements on native perhaps?

@trjExpensify trjExpensify added the External Added to denote the issue can be worked on by a contributor label Feb 21, 2023
@melvin-bot melvin-bot bot unlocked this conversation Feb 21, 2023
@melvin-bot melvin-bot bot changed the title GIF attachments are either displayed as blank or there is infinite loading on attachment preview [$1000] GIF attachments are either displayed as blank or there is infinite loading on attachment preview Feb 21, 2023
@MelvinBot
Copy link

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

@MelvinBot
Copy link

Current assignee @davidcardoza is eligible for the External assigner, not assigning anyone new.

@MelvinBot
Copy link

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

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

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

@Litande
Copy link

Litande commented Feb 21, 2023

Proposal

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

GIF attachments are either displayed as blank or there is infinite loading on attachment preview

What is the root cause of that problem?

on ImageView there is a failure of calc of the zoom sizes due to undefined state of height at the moment of execution.
this height is set onLayout of super view of this component and not happening before the images is loaded (depending of the speed of image loading), those the image is stuck loading/not appearing, on dev it showing quite a bug.

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

I am proposing to ether use promises or useEffect to wait for two initial conditions to happen in ImageView native,

  1. basic load of image (to get width, height)
  2. layout event to get height of container
    after those variables reached we can run a calc and the image will show

What alternative solutions did you explore? (Optional)

none

@Litande
Copy link

Litande commented Feb 22, 2023

Contributor details
Your Expensify account email: mihaelchas@gmail.com
Upwork Profile Link: (https://www.upwork.com/freelancers/michaelchasovin)

@melvin-bot melvin-bot bot added the Overdue label Feb 22, 2023
@MelvinBot
Copy link

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@bernhardoj
Copy link
Contributor

bernhardoj commented Feb 22, 2023

Proposal

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

Image attachment modal show infinite loading when we open a GIF attachment.

What is the root cause of that problem?

We are using react native fast image component to show the image and the loading indicator will be shown when onLoadStart is called.

<Image
style={[
styles.w100,
styles.h100,
this.props.style,
// Hide image while loading so ImageZoom can get the image
// size before presenting - preventing visual glitches or shift
// due to ImageZoom
shouldShowLoadingIndicator ? styles.opacity0 : styles.opacity1,
]}
source={{uri: this.props.url}}
isAuthTokenRequired={this.props.isAuthTokenRequired}
resizeMode={Image.resizeMode.contain}
onLoadStart={this.imageLoadStart}
onLoad={this.configureImageZoom}
/>

imageLoadStart() {
this.setState({isLoading: true});
}

The loading indicator will be hidden after the onLoad is called.

configureImageZoom({nativeEvent}) {
// Wait till animations are over to prevent stutter in navigation animation
this.state.interactionPromise = InteractionManager.runAfterInteractions(() => {
let imageWidth = nativeEvent.width;
let imageHeight = nativeEvent.height;
const containerWidth = Math.round(this.props.windowWidth);
const containerHeight = Math.round(this.state.containerHeight);
const aspectRatio = Math.min(containerHeight / imageHeight, containerWidth / imageWidth);
if (imageHeight > imageWidth) {
imageHeight *= aspectRatio;
} else {
imageWidth *= aspectRatio;
}
// Resize the image to max dimensions possible on the Native platforms to prevent crashes on Android. To keep the same behavior, apply to IOS as well.
const maxDimensionsScale = 11;
imageHeight = Math.min(imageHeight, (this.props.windowHeight * maxDimensionsScale));
imageWidth = Math.min(imageWidth, (this.props.windowWidth * maxDimensionsScale));
this.setState({imageHeight, imageWidth, isLoading: false});
});
}

However, from what I tested, onLoadStart is not always called before onLoad. Sometimes, onLoad is called before onLoadStart. So, we are setting the isLoading to false and then to true afterwards, which make the loading indicator shown indefinitely. This issue also happens to any type of image, but it happens more often to GIF image.

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

Before I explain the solution for this issue, currently, every time I open an image attachment modal, I always get an error that is caused by undefined this.state.containerHeight but configureImageZoom is being called which use that state.

const containerHeight = Math.round(this.state.containerHeight);

We can solve this by render the ImageZoom component after this.state.containerHeight is ready.

{this.state.containerHeight && <ImageZoom>...</ImageZoom>}

Now, the solution for this GH issue is:

  1. Set the initial state of isLoading to true.
  2. Remove onLoadStart

@Santhosh-Sellavel
Copy link
Collaborator

I'll just unassign myself I think I will not be able to get to this sooner, thanks! @bondydaa @davidcardoza Can you reapply external label here to get a new C+ or assign @s77rt If they are willing to take it as C+

@melvin-bot melvin-bot bot removed the Overdue label Feb 22, 2023
@Santhosh-Sellavel Santhosh-Sellavel removed their assignment Feb 22, 2023
@MelvinBot
Copy link

📣 @Santhosh-Sellavel! 📣

Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  2. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  3. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.

Screen Shot 2022-11-16 at 4 42 54 PM

Format:

Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production labels Mar 2, 2023
@melvin-bot melvin-bot bot changed the title [$1000] GIF attachments are either displayed as blank or there is infinite loading on attachment preview [HOLD for payment 2023-03-09] [$1000] GIF attachments are either displayed as blank or there is infinite loading on attachment preview Mar 2, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Mar 2, 2023
@MelvinBot
Copy link

Reviewing label has been removed, please complete the "BugZero Checklist".

@MelvinBot
Copy link

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.2.77-4 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-03-09. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@MelvinBot
Copy link

MelvinBot commented Mar 2, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@s77rt / @bondydaa] The PR that introduced the bug has been identified. Link to the PR:
  • [@s77rt / @bondydaa] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@s77rt / @bondydaa] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@bernhardoj] Propose regression test steps to ensure the same bug will not reach production again.
  • [@davidcardoza] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@bernhardoj
Copy link
Contributor

bernhardoj commented Mar 3, 2023

Regression Test Step

  1. Open any chat
  2. Send an image attachment
  3. Open the image you just sent
  4. Verify the image loaded and shown successfully
  5. Close the image preview
  6. Repeat step 3-5 multiple times

Do we 👍 or 👎 ?

@s77rt
Copy link
Contributor

s77rt commented Mar 3, 2023

cc @bondydaa


@bernhardoj Please update the regression test to take into account that this must be tried 3-5 times given that the reproduction of this issue is somehow random.

@bernhardoj
Copy link
Contributor

@s77rt Is it better to mentioned to repeat a fixed number of times (3-5) or just multiple times?

@s77rt
Copy link
Contributor

s77rt commented Mar 3, 2023

@bernhardoj Any will do 👍

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Mar 9, 2023
@dhanashree-sawant
Copy link

Hi @s77rt , @bondydaa , @davidcardoza, The issue has hold for payment of 9th march, can you have a look once you all are available?

@davidcardoza
Copy link
Contributor

I can process payment. Is it $1000 to @s77rt and @bernhardoj and $250 to @dhanashree-sawant ?

@s77rt
Copy link
Contributor

s77rt commented Mar 11, 2023

@davidcardoza I believe @bernhardoj and I are eligible for 50% timeline bonus.

@davidcardoza
Copy link
Contributor

@bernhardoj and @dhanashree-sawant offers sent. @s77rt payment was sent.

@melvin-bot melvin-bot bot added the Overdue label Mar 14, 2023
@s77rt
Copy link
Contributor

s77rt commented Mar 14, 2023

@bondydaa Checklist ^ #15288 (comment)

@melvin-bot melvin-bot bot removed the Overdue label Mar 14, 2023
@bondydaa
Copy link
Contributor

oh sorry 👍 looks good to me

@melvin-bot melvin-bot bot added the Overdue label Mar 17, 2023
@bondydaa
Copy link
Contributor

are we good to close? i think payments and everything else is set right?

@melvin-bot melvin-bot bot removed the Overdue label Mar 17, 2023
@melvin-bot melvin-bot bot added the Reviewing Has a PR in review label Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review
Projects
None yet
Development

No branches or pull requests