App icon indicating copy to clipboard operation
App copied to clipboard

[HOLD for payment 2021-09-17] Workspace - Add Loading UI after user saves profile photo

Open kavimuru opened this issue 5 years ago • 33 comments

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


Issue was found when executing this PR #4298

Action Performed:

  1. Lunch the app
  2. Log in with expensifail account
  3. Go to Settings - click on any workspace
  4. Click on picture pen and click upload
  5. Click on Save button

Expected Result:

Able to save picture only on first press on the button

Actual Result:

Able to save picture only on second press or 3rd press of the button

Workaround:

Unknown

Platform:

Where is this issue occurring?

  • Android

Version Number: 1.0.83-0 Logs: https://stackoverflow.com/c/expensify/questions/4856 **Notes/Photos/Videos:

https://user-images.githubusercontent.com/43996225/128581801-01dae2cd-8dff-4295-9c76-0c86e109d193.mp4

Expensify/Expensify Issue URL:

View all open jobs on Upwork

this job

kavimuru avatar Aug 07 '21 00:08 kavimuru

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

OSBotify avatar Aug 07 '21 00:08 OSBotify

Triggered auto assignment to @ctkochan22 (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

MelvinBot avatar Aug 07 '21 00:08 MelvinBot

Proposal

The user doesn't have to click twice to save the picture. Basically, there isn't any feedback to the user on changes being saved. Need to do two things:

  1. Show a success/error message on Save
  2. While the API is running disable the Save button

In WorkspaceEditorPage.js,

    this.state = {
       isSubmitting: true
    }


    submit() {
        this.setState({ isSubmitting: true});
        this.uploadAvatarPromise.then(() => {
            const name = this.state.name.trim();
            const avatarURL = this.state.avatarURL;
            const policyID = this.props.policy.id;

            update(policyID, {name, avatarURL});
            this.setState({ isSubmitting: false}); // Manage flag state
            Growl.sucess(translate('updatesuccess')); // Show feedback to the server
        }).catch(err => {
            this.setState({ isSubmitting: false});
            Growl.error(translate('updateFailed'));
        });
   }. 


   <Button
        success
        isDisabled={this.state.isSubmitting} /// Disable button when submitting
        style={[styles.w100]}
        text={this.props.translate('workspace.editor.save')}
        onPress={this.submit}
        pressOnEnter
   />

Try with a smaller size image you'll see it redirects quickly.

mananjadhav avatar Aug 07 '21 00:08 mananjadhav

I don't think this is a blocker. It looks like there is just no UI feedback that indicates that the request was sent and we are awaiting a response.

Can we close this or edit the title to `Add loading gif/ui once "save" button is clicked

ctkochan22 avatar Aug 10 '21 05:08 ctkochan22

Triggered auto assignment to @puneetlath (AutoAssignerTriage), see https://stackoverflow.com/c/expensify/questions/4749 for more details.

MelvinBot avatar Aug 10 '21 05:08 MelvinBot

I was able to confirm that this behavior is also happening on iOS as well.

puneetlath avatar Aug 10 '21 14:08 puneetlath

@ctkochan22 if you think this is a good external candidate, add the external label please!

puneetlath avatar Aug 10 '21 14:08 puneetlath

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

MelvinBot avatar Aug 12 '21 17:08 MelvinBot

weird that being assigned something via auto assigner doesn't remove the overdue label. this made it seem like I had an issue overdue, when really I'd just been assigned to it a couple hours ago.

jboniface avatar Aug 12 '21 19:08 jboniface

posted https://www.upwork.com/jobs/~01cdb87ac85566935f

jboniface avatar Aug 12 '21 19:08 jboniface

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

MelvinBot avatar Aug 12 '21 19:08 MelvinBot

Proposal

  1. We can use a flag in state loading that keeps track of the update promise.

  2. on Submit , set this flag to true, and then when the promise resolves set is back to false. https://github.com/Expensify/App/blob/e4f4ed7b9f649d46c2cc0696f4bf5e3bcf0403a4/src/pages/workspace/WorkspaceEditorPage.js#L65

  3. If we want to truly track the update process. We can return the API promise here https://github.com/Expensify/App/blob/e4f4ed7b9f649d46c2cc0696f4bf5e3bcf0403a4/src/libs/actions/Policy.js#L243

  4. thus waiting for both uploadAvatarPromise and Save Api calls promises to resolve before setting the loading to false. Otherwise, we can just set the flag after uploadAvatarPromise resolves. 5.Finally using this flag on the Button isLoading prop. https://github.com/Expensify/App/blob/e4f4ed7b9f649d46c2cc0696f4bf5e3bcf0403a4/src/pages/workspace/WorkspaceEditorPage.js#L125.

  5. Optionally, we can show a success message after Everything is done. Growl.show(this.props.translate('workspaceEdit.growlMessageOnSave'), CONST.GROWL.SUCCESS, 3000);

parasharrajat avatar Aug 17 '21 22:08 parasharrajat

cc: @roryabraham Proposal https://github.com/Expensify/App/issues/4487#issuecomment-894579175

mananjadhav avatar Aug 18 '21 04:08 mananjadhav

Very sorry for the delay here. @mananjadhav your original proposal looks good 👍

The only thing I would add is that the save button should be disabled if there are no changes from what is already saved.

roryabraham avatar Aug 20 '21 03:08 roryabraham

Okay @roryabraham I'll take a note of that. I'll check if the image is replaced or the title is changed and accordingly enabled/disable the save button.

mananjadhav avatar Aug 20 '21 03:08 mananjadhav

@jboniface, @roryabraham it looks like no one is assigned to work on this job. Please double the price or add a comment stating why the job isn't being doubled.

MelvinBot avatar Aug 20 '21 19:08 MelvinBot

@jboniface Let's hire @mananjadhav for this so he can get started implementing the solution 👍

roryabraham avatar Aug 23 '21 17:08 roryabraham

progress is still being made on the PR

jboniface avatar Aug 31 '21 19:08 jboniface

PR is under review.

mananjadhav avatar Sep 01 '21 03:09 mananjadhav

@roryabraham @jboniface

I was wondering if we could bump the budget for this one considering the amount of work we achieved with the PR.

Wouldn't have asked if I was the reporter as would've received the bonus. Hope you'll consider.

mananjadhav avatar Sep 09 '21 03:09 mananjadhav