Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.34k stars 2.77k forks source link

[HOLD for payment 2023-07-26] [$1000] LHN header avatar disappears for a brief moment when refreshing page #22514

Closed kavimuru closed 1 year ago

kavimuru commented 1 year ago

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. Login to any account
  2. Reload website
  3. Notice Avatar doesn't instantly show

    Expected Result:

    Avatar will always remain/show

    Actual Result:

    Avatar doesn't show until page is fully loaded - there is a ~1 second delay.

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

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

Version Number: 1.3.38-2 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: Any additional supporting documentation

https://github.com/Expensify/App/assets/43996225/9caaa8af-3497-4aa8-85e9-3c7e6b103c6e

https://github.com/Expensify/App/assets/43996225/0caf7461-034d-4c06-bbf2-a8dd8462d8b3

Expensify/Expensify Issue URL: Issue reported by: @situchan Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1688843824514419

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01a250dc528d0d38dd
  • Upwork Job ID: 1678196247823577088
  • Last Price Increase: 2023-07-10
melvin-bot[bot] commented 1 year ago

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

melvin-bot[bot] commented 1 year ago

Bug0 Triage Checklist (Main S/O)

chiragxarora commented 1 year ago

Not reproducible on latest main

jliexpensify commented 1 year ago

Also just tested in v1.3.38-3 and I don't see this behaviour anymore:

https://github.com/Expensify/App/assets/30815269/e30c478e-07c7-40fe-94db-c83dbee199ae

jliexpensify commented 1 year ago

Actually, I take that back - I notice that in my last video, the avatar initially was a default one, before switching to mine.

So I tested on another random convo and I can now reproduce:

https://github.com/Expensify/App/assets/30815269/e4bf1340-ccab-4e46-808f-28369e4a9dfe

melvin-bot[bot] commented 1 year ago

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

melvin-bot[bot] commented 1 year ago

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

melvin-bot[bot] commented 1 year ago

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

situchan commented 1 year ago

Proposal

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

LHN header avatar disappears for a brief moment when refreshing page

What is the root cause of that problem?

AvatarWithIndicator is wrapped with withOnyx HOC. There's Onyx data loading time before render.

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

As only indicator uses onyx data, we can render Avatar always and lazy-load only indicator.

Implementation detail: separate AvatarWithIndicator component into 2:

Demo

https://github.com/Expensify/App/assets/108292595/a2ca6962-f108-4432-a37b-f0ad4f7ca82e

https://github.com/Expensify/App/assets/108292595/faf55940-4733-492c-bd71-acc2f7812cce

binary3oul commented 1 year ago

Proposal


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

LHN header avatar disappears for a brief moment when refreshing page

What is the root cause of that problem?

There is a slight delay when loading the asset image.

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

I discovered that this issue is exclusive to https://new.expensify.com/ and does not occur locally. So I've implemented caching for the avatar image. React Native inherently supports this functionality.

What alternative solutions did you explore? (Optional)

jliexpensify commented 1 year ago

Hi @rushatgabhane , we've got a couple of proposals coming in - could you review?

ghost commented 1 year ago

Proposal Please re-state the problem that we are trying to solve in this issue. LHN header avatar disappears for a brief moment when refreshing page.

What is the root cause of that problem? I think the main reason, for it is whenever a component mounts, it triggers lifecycle methods, and in this case, we are fetching data from Onyx (a state management library used in your application). If the Avatar's source is fetched asynchronously, this would lead to a delay in rendering the avatar image, causing it to disappear during the page refresh.

What changes do you think we should make in order to solve the problem? To solve this issue, what I think we can do is add a placeholder image and then when we reload the actual avatar get displayed.

import PlaceholderImage from './path-to-placeholder-image'; // Import placeholder image

function AvatarWithIndicator(props) {

    // Use placeholder image if the source URL is not yet available
    const avatarSource = UserUtils.getSmallSizeAvatar(props.source) || PlaceholderImage; 

    return (
        <Tooltip text={props.tooltipText}>
            <View style={[styles.sidebarAvatar]}>
                <Avatar source={avatarSource} />
                {(shouldShowErrorIndicator || shouldShowInfoIndicator) && <View style={StyleSheet.flatten(indicatorStyles)} />}
            </View>
        </Tooltip>
    );
}

What alternative solutions did you explore? (Optional)

rushatgabhane commented 1 year ago

@situchan sounds good! what happens when even the Avatar isn't available? eg: after a fresh logout and sign in

situchan commented 1 year ago

@situchan sounds good! what happens when even the Avatar isn't available? eg: after a fresh logout and sign in

It won't be affected by my change, same as production. This issue happens only when app refresh.

https://github.com/Expensify/App/assets/108292595/0a9f4bab-8e50-4a34-9487-4ab37e041485

ghost commented 1 year ago

hey! I am new here! Can someone tell me if my Proposal is fine or not?

rushatgabhane commented 1 year ago

thanks for confirming @situchan https://github.com/Expensify/App/issues/22514#issuecomment-1628233400 c+ reviewed πŸŽ€ πŸ‘€ πŸŽ€

melvin-bot[bot] commented 1 year ago

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

rushatgabhane commented 1 year ago

@AnshuAgarwal24 sorry, @situchan posted a good proposal before you

francoisl commented 1 year ago

Sounds good to me as well, let's go with @situchan's proposal.

melvin-bot[bot] commented 1 year ago

πŸ“£ @rushatgabhane Please request via NewDot manual requests for the Reviewer role ($1000)

melvin-bot[bot] commented 1 year ago

πŸ“£ @situchan You have been assigned to this job! Please apply to the Upwork job and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review πŸ§‘β€πŸ’» Once you apply to this job, your Upwork ID will be stored and you will be automatically hired for future jobs! Keep in mind: Code of Conduct | Contributing πŸ“–

melvin-bot[bot] commented 1 year ago

πŸ“£ @situchan We're missing your Upwork ID to automatically send you an offer for the Reporter role. Once you apply to the Upwork job, your Upwork ID will be stored and you will be automatically hired for future jobs!

situchan commented 1 year ago

@rushatgabhane PR is ready for review

melvin-bot[bot] commented 1 year ago

🎯 ⚑️ Woah @rushatgabhane / @situchan, great job pushing this forwards! ⚑️

The pull request got merged within 3 working days of assignment, so this job is eligible for a 50% #urgency bonus πŸŽ‰

On to the next one πŸš€

jliexpensify commented 1 year ago

@situchan just invited you: $250 + $1500 @rushatgabhane you'll be paid via New.Dot, please request with Anu!

melvin-bot[bot] commented 1 year ago

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

melvin-bot[bot] commented 1 year ago

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

If no regressions arise, payment will be issued on 2023-07-26. :confetti_ball:

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.

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

melvin-bot[bot] commented 1 year ago

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:

jliexpensify commented 1 year ago

Bump @rushatgabhane to complete the checklist.

Also, this qualifies for a bonus.

jliexpensify commented 1 year ago

Bump @rushatgabhane to complete the list before payment is released:

Upwork job

jliexpensify commented 1 year ago

Bump @rushatgabhane to complete the list before payment

rushatgabhane commented 1 year ago
  1. The PR that introduced the bug has been identified. Link to the PR: Too small edge case imo πŸ˜… And we had AvatarWithIndicator since the beginning of time :)

  2. 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: N.A.

  3. 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: No

  4. Determine if we should create a regression test for this bug. - No

  5. If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again - N.A.

rushatgabhane commented 1 year ago

https://staging.new.expensify.com/r/5799653570845860

jliexpensify commented 1 year ago

Nice, thanks you @rushatgabhane - will sort out payment today.

jliexpensify commented 1 year ago

Paid and job closed - cheers!

JmillsExpensify commented 1 year ago

Reviewed details for @rushatgabhane. These details are accurate based on summary from Business Reviewer and are now approved for payment in NewDot.