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

[$500] Android - Distance - Tabs switch highlight between Manual and Distance when map is rendering #32554

Closed
1 of 6 tasks
izarutskaya opened this issue Dec 6, 2023 · 10 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@izarutskaya
Copy link

izarutskaya commented Dec 6, 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!


Version Number: v1.4.8-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
Expensify/Expensify Issue URL:
Issue reported by: Applause-Internal Team
Slack conversation: @

Action Performed:

Precondition:

  • App location access is denied
  • Make sure Distance page is opened when Request money page is opened.
  1. Launch New Expensify app.
  2. Tap +.
  3. Tap Request money.

Expected Result:

Only the distance tab is highlighted.

Actual Result:

The tabs switch highlight from Manual to Distance when the map is rendering.

Workaround:

Unknown

Platforms:

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

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

Screenshots/Videos

Bug6302707_1701837650563.Screen_Recording_20231206_034613_New_Expensify.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~015ce5c4e833c5e836
  • Upwork Job ID: 1732347541742956544
  • Last Price Increase: 2023-12-06
@izarutskaya izarutskaya added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Dec 6, 2023
@melvin-bot melvin-bot bot changed the title Android - Distance - Tabs switch highlight between Manual and Distance when map is rendering [$500] Android - Distance - Tabs switch highlight between Manual and Distance when map is rendering Dec 6, 2023
Copy link

melvin-bot bot commented Dec 6, 2023

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

Copy link

melvin-bot bot commented Dec 6, 2023

Job added to Upwork: https://www.upwork.com/jobs/~015ce5c4e833c5e836

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

melvin-bot bot commented Dec 6, 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

Copy link

melvin-bot bot commented Dec 6, 2023

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

@ikevin127
Copy link
Contributor

ikevin127 commented Dec 6, 2023

Proposal

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

When opening Request Money on Distance tab, the tabs switch highlight between Distance and Manual while the map is rendering.

What is the root cause of that problem?

The cause of this issue is the fact that TabSelector.js component is re-rendering multiple times because its state prop is being passed from the parrent component multiple times even though the state's prop value is the same.

Because the same state prop value is passed multiple times to the TabSelector component and the component's logic uses the state prop to apply selected tab highlight, everytime the component is re-rendered the styles reset for a few ms because of the logic added by PR #29231 (the useEffect), which causes this issue.

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

Wrap TabSelector component export with memo where we're checking _.isEqual(prevProps.state, nextProps.state). With this applied, the component will only render once and the issue won't occur anymore.

Changed code

-       export default TabSelector;

+       export default memo(TabSelector, (prevProps, nextProps) =>  
+           _.isEqual(prevProps.state, nextProps.state),
+       );

Videos

Android: Native
Screen.Recording.2023-12-06.at.19.04.22.mov

@melvin-bot melvin-bot bot added the Overdue label Dec 8, 2023
@allroundexperts
Copy link
Contributor

I think @ikevin127 has the correct RCA and the solution proposed seems fine as well. As a suggestion, I think it would be better to memoize the state prop in the parent component (since that is the root cause of the problem) instead of memoizing it in the TabSelector.

Let's go with @ikevin127's proposal.

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Dec 10, 2023

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

@aimane-chnaif
Copy link
Contributor

Not able to reproduce after refactor

@allroundexperts
Copy link
Contributor

Just pulled the latest code and retested. This seems to be fixed!

Let's close this.

@ikevin127
Copy link
Contributor

I agree, the old code related to this issue was prone to future issues.

The refactor did it justice!

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. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
None yet
Development

No branches or pull requests

6 participants