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.33k stars 2.76k forks source link

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

Open IuliiaHerets opened 2 weeks ago

IuliiaHerets commented 2 weeks 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!


Version Number: v9.0.26-1 Reproducible in staging?: Y Reproducible in production?: N Email or phone of affected tester (no customers): applausetester+kh050806@applause.expensifail.com Issue reported by: Applause Internal Team

Action Performed:

Precondition:

  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:

Screenshots/Videos

https://github.com/user-attachments/assets/d7ab6496-b96b-4475-ab02-3ae45f2d9260

View all open jobs on GitHub

melvin-bot[bot] commented 2 weeks ago

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.

github-actions[bot] commented 2 weeks ago

:wave: 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[bot] commented 2 weeks ago

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

daledah commented 2 weeks ago

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 commented 2 weeks ago

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. https://github.com/Expensify/App/blob/e77f20458ad13d94c7b0188acc2ed1a91bd8ccbd/src/pages/settings/Profile/ProfilePage.tsx#L158-L160

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. https://github.com/Expensify/App/blob/e77f20458ad13d94c7b0188acc2ed1a91bd8ccbd/src/components/AvatarSkeleton.tsx#L9-L22

  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 commented 2 weeks ago

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

dangrous commented 2 weeks ago

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!

dangrous commented 2 weeks ago

assigning rushat to this one

dangrous commented 2 weeks ago

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

rushatgabhane commented 2 weeks ago

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

melvin-bot[bot] commented 1 week ago

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

dangrous commented 1 week ago

That sounds good @rushatgabhane!

melvin-bot[bot] commented 1 week ago

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

adelekennedy commented 1 week ago

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

dangrous commented 6 days ago

PR is in C+ review!