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-09-29] [$1000] Web - Profile - Profile error is not dismissed even after opening further menus and coming back #25405

Closed
1 of 6 tasks
izarutskaya opened this issue Aug 17, 2023 · 40 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

Comments

@izarutskaya
Copy link

izarutskaya commented Aug 17, 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
  2. Open settings
  3. Open profile
  4. Click on profile pic and upload unsupported image eg: webp format image
  5. Observe that app displays error below profile picture
  6. Open any submenu like Display name, Contact method and revisit back to profile
  7. Observe that error is still not dismissed

Expected Result:

App should dismiss error on profile page as soon as we navigate to another page

Actual Result:

App does not dismiss error on profile page even when we navigate to another page

Workaround:

Unknown

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: v1.3.55-1

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

2575716424650642242error_not_dismissed_profile_page.MP4
Recording.5886.mp4

Expensify/Expensify Issue URL:

Issue reported by: @dhanashree-sawant

Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1691319644122389

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~014ab616209feb88d9
  • Upwork Job ID: 1692451442740764672
  • Last Price Increase: 2023-08-25
  • Automatic offers:
    • jjcoffee | Reviewer | 26401335
    • dukenv0307 | Contributor | 26401336
    • Dhanashree-Sawant | Reporter | 26401337
@izarutskaya izarutskaya added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 17, 2023
@dukenv0307
Copy link
Contributor

Proposal

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

Profile error is not dismissed even after opening further menus and coming back

What is the root cause of that problem?

We use Navigation.navigate to open other menus so ProfilePage is already in stack navigator. And then when we goBack to this page, the old state is displayed and we don't clear the error in AvatarWithImagePicker if the page is focused again.

onPress={() => Navigation.navigate(detail.pageRoute)}

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

In AvatarWithImagePicker, we should use withNavigationFocus HOC to listen when the page is focused and then in componentDidUpdate we will clear the error if it is focused.

if (!prevProps.isFocused && this.props.isFocused) {
    this.setError(null, {})
}

What alternative solutions did you explore? (Optional)

NA

Result

Screen.Recording.2023-08-14.at.11.06.28.mov

@namhihi237
Copy link
Contributor

Proposal

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

The app should dismiss the error on the profile page as soon as we navigate to another page

What is the root cause of that problem?

We are saving the error at state:

this.state = {
isMenuVisible: false,
validationError: null,

We are saving an error in the state, That's why when we go to the next page and then back to the previous page will not unmount that's why the state is not clear

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

We should add the logic to clear error when the page is visible again in componentDidUpdate using withNavigationFocus.

        if (!prevProps.isFocused && this.props.isFocused) {
            this.setError(null,{});
        }

What alternative solutions did you explore? (Optional)

N/A

@melvin-bot
Copy link

melvin-bot bot commented Aug 17, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 17, 2023

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

@laurenreidexpensify laurenreidexpensify added the External Added to denote the issue can be worked on by a contributor label Aug 18, 2023
@melvin-bot melvin-bot bot changed the title Web - Profile - Profile error is not dismissed even after opening further menus and coming back [$1000] Web - Profile - Profile error is not dismissed even after opening further menus and coming back Aug 18, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 18, 2023

Job added to Upwork: https://www.upwork.com/jobs/~014ab616209feb88d9

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

melvin-bot bot commented Aug 18, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 18, 2023

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

@lucentdevteam
Copy link

Proposal

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

[$1000] Web - Profile - Profile error is not dismissed even after opening further menus and coming back #25405 - Expensify

What is the root cause of that problem?

Because validationError variable is part of state and is not updated automatically during navigating to other pages

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

I feel we should add following changes in code

  • State should be updated with page change

What alternative solutions did you explore? (Optional)

  • We feel we can auto hide errors, by change error status to false after 3 seconds.

@shubham1206agra
Copy link
Contributor

Proposal

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

Web - Profile - Profile error is not dismissed even after opening further menus and coming back

What is the root cause of that problem?

We are using the state to save the errors in the AvatarWithImagePicker component here

this.state = {
isMenuVisible: false,
validationError: null,

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

Since we are moving towards functional components in the future, we should migrate the component to a functional one in this issue only.
After migration
In AvatarWithImagePicker, we can use useImperativeHandle to expose a method for clearing the errors

useImperativeHandle(ref, () => ({
    clearError() {
        setError(null, {});
    }
}));

And use it before Navigation calls like this by using ref ref.current.clearError()

Or

After refactoring, we can use useIsFocused hook from @react-navigation/native but this makes code a little complex

What alternative solutions did you explore? (Optional)

@melvin-bot melvin-bot bot added the Overdue label Aug 21, 2023
@laurenreidexpensify
Copy link
Contributor

@jjcoffee bump for review on these ^^

@melvin-bot melvin-bot bot removed the Overdue label Aug 21, 2023
@jjcoffee
Copy link
Contributor

Reviewing now!

@jjcoffee
Copy link
Contributor

jjcoffee commented Aug 21, 2023

@dukenv0307 proposal LGTM! It has the correct RCA and a good solution, so I'm happy to go with it.

@shubham1206agra's suggestion to migrate the component to a functional one is nice, but seems a bit out of scope for this issue. Happy to defer to @neil-marcellini if they disagree!

For completeness' sake - @namhihi237 and @lucentdevteam are duplicates of @dukenv0307's proposal.

🎀👀🎀 C+ reviewed

@melvin-bot
Copy link

melvin-bot bot commented Aug 21, 2023

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

@shubham1206agra
Copy link
Contributor

@dukenv0307 proposal LGTM! It has the correct RCA and a good solution, so I'm happy to go with it.

@shubham1206agra's suggestion to migrate the component to a functional one is nice, but seems a bit out of scope for this issue. Happy to defer to @neil-marcellini if they disagree!

For completeness' sake - @namhihi237 and @lucentdevteam are duplicates of @dukenv0307's proposal.

🎀👀🎀 C+ reviewed

@jjcoffee I was only saying to migrate to the functional component, as when we move to a functional component in future, the code using ComponentDidMount will also migrate, and I saw that it generally reduced to using useImperativeHandle for this kind of logic as other solution requires extra hooks and make code looks complex.

Meanwhile, I don't have any problem if the internal team decides not to migrate right now.

@kaushiktd
Copy link
Contributor

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

Profile error is not dismissed even after opening further menus and coming back

What is the root cause of that problem?

We use Navigation.navigate to open other menus, ProfilePage is already in the stack navigator. when we go to the other menu and come back,
the state in avatarWithImagePicker is not changing that's why the error is shown.

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

In the AvatarWithImagePicker component, expose a method to clear the error directly using a regular class method on the below file:
https://github.com/Expensify/App/blob/main/src/components/AvatarWithImagePicker.js#L111-L113

class AvatarWithImagePicker extends React.Component {
// ... other code

clearError() {
this.setState({ validationError: null });
}

// ... other code
}

In our parent component, where we are rendering the ProfilePage, we can use a ref to call the clearError method on the AvatarWithImagePicker component here:
https://github.com/Expensify/App/blob/main/src/pages/settings/Profile/ProfilePage.js

function ProfilePage(props) {
// ... other code
const avatarRef = useRef(null);
// ... other code
return (
<ScreenWrapper includeSafeAreaPaddingBottom={false}>
{/* ... other JSX */}
<ScrollView>
<AvatarWithImagePicker
ref={avatarRef}
// ... other props
/>
{/* ... other JSX */}
</ScrollView>
</ScreenWrapper>
);
}

When we want to navigate to a new screen, call the clearError method within MenuItemWithTopDescription component here
https://github.com/Expensify/App/blob/main/src/pages/settings/Profile/ProfilePage.js#L131

onPress = {() => {
if (avatarRef.current) {
avatarRef.current.clearError();
}

Navigation.navigate(detail.pageRoute);
}}

change in onPress function here:
https://github.com/Expensify/App/blob/main/src/pages/settings/Profile/ProfilePage.js#L139

onPress = {() => {
if (avatarRef.current) {
avatarRef.current.clearError();
}
 
Navigation.navigate(ROUTES.SETTINGS_PERSONAL_DETAILS)
}}

Video:
https://drive.google.com/file/d/1EJ5oEk_3MTHlBjNxWxrru3-ozDweRemo/view?usp=sharing

@melvin-bot melvin-bot bot added the Overdue label Aug 23, 2023
@laurenreidexpensify
Copy link
Contributor

@neil-marcellini is OOO, finding someoen else to review

@melvin-bot melvin-bot bot removed the Overdue label Aug 23, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 25, 2023

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@melvin-bot melvin-bot bot added the Overdue label Aug 25, 2023
@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Aug 30, 2023
@dukenv0307
Copy link
Contributor

@jjcoffee The PR is ready to review.

@jjcoffee
Copy link
Contributor

@neil-marcellini In this case I think you'd see that the avatar hasn't updated and so navigating away from the page is a sort of implicit dismissal of the error message. Open to arguments though!

@laurenreidexpensify
Copy link
Contributor

We're ready to merge this one I believe

@jjcoffee
Copy link
Contributor

@laurenreidexpensify I think @neil-marcellini is OOO, should we assign another engineer?

@melvin-bot
Copy link

melvin-bot bot commented Sep 18, 2023

Based on my calculations, the pull request did not get merged within 3 working days of assignment. Please, check out my computations here:

  • when @dukenv0307 got assigned: 2023-08-30 00:20:55 Z
  • when the PR got merged: 2023-09-18 21:41:17 UTC
  • days elapsed: 13

On to the next one 🚀

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Sep 22, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Web - Profile - Profile error is not dismissed even after opening further menus and coming back [HOLD for payment 2023-09-29] [$1000] Web - Profile - Profile error is not dismissed even after opening further menus and coming back Sep 22, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Sep 22, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 22, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 22, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.72-11 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-09-29. 🎊

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

For reference, here are some details about the assignees on this issue:

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 22, 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:

  • [@jjcoffee] The PR that introduced the bug has been identified. Link to the PR:
  • [@jjcoffee] 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:
  • [@jjcoffee] 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:
  • [@jjcoffee] Determine if we should create a regression test for this bug.
  • [@jjcoffee] 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.
  • [@laurenreidexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@jjcoffee
Copy link
Contributor

  • The PR that introduced the bug has been identified. Link to the PR: N/A - looks like the behaviour was always there.
  • 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
  • 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: N/A
  • Determine if we should create a regression test for this bug. No - I don't think it's particularly impactful for an error to get "stuck".
  • 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

@jjcoffee
Copy link
Contributor

@laurenreidexpensify Just noting that the PR was approved with a small change that was addressed within 3WD, then merging was delayed due to the internal engineer being OOO (as well as the merge freeze) so I think the timeliness bonus may be due here.

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Sep 29, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 2, 2023

@neil-marcellini, @jjcoffee, @laurenreidexpensify, @dukenv0307 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@neil-marcellini
Copy link
Contributor

Not overdue, bump @laurenreidexpensify

@melvin-bot melvin-bot bot removed the Overdue label Oct 2, 2023
@laurenreidexpensify
Copy link
Contributor

@jjcoffee agree - with synopsis, will adjust now

@laurenreidexpensify
Copy link
Contributor

Payment Summary:

  • External issue reporter - @dhanashree-sawant $250, payment issued in Upwork
  • Contributor that fixed the issue - @dukenv0307 $1000 + 50% bonus = $1500, payment issued in Upwork
  • Contributor+ that helped on the issue and/or PR - @jjcoffee $1000 + 50% = $1500, payment issued in Upwork

@laurenreidexpensify
Copy link
Contributor

@jjcoffee bump on regression steps + final checklist

@jjcoffee
Copy link
Contributor

jjcoffee commented Oct 3, 2023

@laurenreidexpensify Thanks! Checklist is completed here.

@laurenreidexpensify
Copy link
Contributor

great thanks, we done!

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
Projects
None yet
Development

No branches or pull requests

9 participants