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

Profile - Avatar edit modal can be opened while app is loading #48259

Closed
6 tasks done
IuliiaHerets opened this issue Aug 29, 2024 · 18 comments
Closed
6 tasks done

Profile - Avatar edit modal can be opened while app is loading #48259

IuliiaHerets opened this issue Aug 29, 2024 · 18 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Engineering Reviewing Has a PR in review Weekly KSv2

Comments

@IuliiaHerets
Copy link

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: v9.0.26-1
Reproducible in staging?: Y
Reproducible in production?: N
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team

Action Performed:

Precondition:

  • Account has default avatar.
  1. Go to staging.new.expensify.com
  2. Go offline or set the network speed to 3G in network tab
  3. Go to Troubleshoot > Clear cache and restart/
  4. Click Reset and refresh.
  5. Go to Profile.
  6. Click on the avatar.
  7. Click Remove photo.

Expected Result:

User should not be able to open avatar edit modal when the app is loading (production behavior).

Actual Result:

User can open avatar edit modal when the app is loading. Remove photo option is shown even when the account has default avatar when the app is loading.

Workaround:

Unknown

Platforms:

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6586366_1724926270465.20240829_180604.mp4

View all open jobs on GitHub

@IuliiaHerets IuliiaHerets added DeployBlockerCash This issue or pull request should block deployment Bug Something is broken. Auto assigns a BugZero manager. labels Aug 29, 2024
Copy link

melvin-bot bot commented Aug 29, 2024

Triggered auto assignment to @adelekennedy (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@melvin-bot melvin-bot bot added the Daily KSv2 label Aug 29, 2024
@github-actions github-actions bot added Engineering Hourly KSv2 and removed Daily KSv2 labels Aug 29, 2024
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.

Copy link

melvin-bot bot commented Aug 29, 2024

Triggered auto assignment to @dangrous (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

@daledah
Copy link
Contributor

daledah commented Aug 29, 2024

Proposal

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

User can open avatar edit modal when the app is loading. Remove photo option is shown even when the account has default avatar when the app is loading.

What is the root cause of that problem?

this is new feature

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

We will disable this avatar while the app is loading in here

    disabled={isAvatarCropModalOpen || (disabled && !enablePreview) || isLoadingApp}

with

    const [isLoadingApp] = useOnyx(ONYXKEYS.IS_LOADING_APP);

What alternative solutions did you explore? (Optional)

@bernhardoj
Copy link
Contributor

Proposal

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

We can edit the avatar while the app is loading.

What is the root cause of that problem?

Before the account switcher PR, the avatar is only shown on the initial settings page and a skeleton will replace it if the app is "loading".
image

Now, we also show/move the editable avatar on the profile page.

<AvatarWithImagePicker
isUsingDefaultAvatar={UserUtils.isDefaultAvatar(currentUserPersonalDetails?.avatar ?? '')}
source={avatarURL}

But we never replace it with a skeleton when the app is loading.

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

We can have the same skeleton condition from InitialSettingsPage and show the skeleton when satisfied.

{isEmptyObject(currentUserPersonalDetails) || currentUserPersonalDetails.displayName === undefined ? (
    <AvatarSkeleton size={CONST.AVATAR_SIZE.XLARGE} />
) : (
    <AvatarWithImagePicker .../>

We can use the existing AvatarSkeleton, but we need to make some adjustments to the component. Currently, the skeleton has a static size of 28.

const skeletonCircleRadius = variables.sidebarAvatarSize / 2;
return (
<SkeletonViewContentLoader
animate
height={variables.sidebarAvatarSize}
backgroundColor={theme.skeletonLHNIn}
foregroundColor={theme.skeletonLHNOut}
>
<Circle
cx={skeletonCircleRadius}
cy={skeletonCircleRadius}
r={skeletonCircleRadius}
/>

  1. Accept a size type props. (default to CONST.AVATAR_SIZE.SMALL)
  2. Calculate the size using StyleUtils.getAvatarSize and use it on the radius and height
const StyleUtils = useStyleUtils();
const avatarSize = StyleUtils.getAvatarSize(size);
const skeletonCircleRadius = avatarSize / 2;

return (
    <SkeletonViewContentLoader
        animate
        height={avatarSize}

@adelekennedy
Copy link

@dangrous this doesn't seem like a deploy blocker to me

@dangrous
Copy link
Contributor

Yeah I don't think this needs to block, not a regression just a minor issue with a new feature. But yeah, let's get this fixed soonish!

@puneetlath puneetlath added Daily KSv2 and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Aug 29, 2024
@dangrous
Copy link
Contributor

assigning rushat to this one

@dangrous
Copy link
Contributor

@rushatgabhane let us know what you're thinking about this one, thanks!

@rushatgabhane
Copy link
Member

i guess we should add skeleton for avatar when it is loading

@melvin-bot melvin-bot bot added the Overdue label Sep 2, 2024
Copy link

melvin-bot bot commented Sep 2, 2024

@dangrous, @rushatgabhane, @adelekennedy Whoops! This issue is 2 days overdue. Let's get this updated quick!

@dangrous
Copy link
Contributor

dangrous commented Sep 3, 2024

That sounds good @rushatgabhane!

@melvin-bot melvin-bot bot removed the Overdue label Sep 3, 2024
@rushatgabhane rushatgabhane mentioned this issue Sep 4, 2024
50 tasks
@melvin-bot melvin-bot bot added the Overdue label Sep 5, 2024
Copy link

melvin-bot bot commented Sep 6, 2024

@dangrous, @rushatgabhane, @adelekennedy Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@adelekennedy
Copy link

@rushatgabhane @dangrous how are we doing with this one? I see it's been grouped up with other issues here should we drop the priority of this one?

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Overdue Daily KSv2 labels Sep 8, 2024
@dangrous
Copy link
Contributor

dangrous commented Sep 9, 2024

PR is in C+ review!

@dangrous
Copy link
Contributor

This was deployed to production 9/19, so we can close on 9/26 assuming all goes well. No payment needed on this one since it was a bug from copilot, right?

@adelekennedy
Copy link

@dangrous I think that makes sense - all payment for these issues are being grouped together?

@dangrous
Copy link
Contributor

yep!

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. Engineering Reviewing Has a PR in review Weekly KSv2
Projects
None yet
Development

No branches or pull requests

7 participants