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 2024-07-24] [$250] Distance - Start and Stop labels do not change when dragging one over another #44153

Closed
1 of 6 tasks
izarutskaya opened this issue Jun 21, 2024 · 31 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 Jun 21, 2024

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: 9.0.0.0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4652117
Logs: https://stackoverflow.com/c/expensify/questions/4856
Issue reported by: Applause-Internal team

Action Performed:

  1. Launch New Expensify app.
  2. Go to FAB > Submit expense > Distance.
  3. Drag empty Stop row over empty Start row.
  4. Note that the Stop label does not change to Start and Start label does not change to stop.
  5. Tap on the Stop row.
  6. Select a waypoint.
  7. Now Stop and Start rows overlap with one another.

Expected Result:

In Step 4, Stop label will change to Start and Start label will change to stop.

Actual Result:

In Step 4, Stop label does not change to Start and Start label does not change to stop.
In Step 7, when selecting a waypoint, Stop and Start rows overlap with one another.

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

Bug6520253_1718958048871.Screen_Recording_20240621_161639_New_Expensify.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01b23211c128469d40
  • Upwork Job ID: 1805046118243790605
  • Last Price Increase: 2024-06-24
  • Automatic offers:
    • hoangzinh | Contributor | 102892776
    • Krishna2323 | Contributor | 102911936
Issue OwnerCurrent Issue Owner: @jliexpensify
@izarutskaya izarutskaya added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jun 21, 2024
Copy link

melvin-bot bot commented Jun 21, 2024

Triggered auto assignment to @jliexpensify (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.

@izarutskaya
Copy link
Author

We think this issue might be related to the #collect project.

@Krishna2323
Copy link
Contributor

Krishna2323 commented Jun 21, 2024

Proposal

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

Distance - Start and Stop labels do not change when dragging one over another

What is the root cause of that problem?

The draggable list requires key for correctly render the items when dragged. When we create draft transaction, there is no key for empty waypoints and due to this the list isn't updated correctly.

App/src/libs/actions/IOU.ts

Lines 339 to 344 in 9817d3c

// Add initial empty waypoints when starting a distance expense
if (iouRequestType === CONST.IOU.REQUEST_TYPE.DISTANCE) {
comment.waypoints = {
waypoint0: {},
waypoint1: {},
};

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

We need to make sure that we add keys for empty waypoints too, we can create a const for initial waypoints list.

        comment.waypoints = {
            waypoint0: {keyForList: 'start_waypoint'},
            waypoint1: {keyForList: 'stop_waypoint'},
        };

const waypoints = useMemo(() => optimisticWaypoints ?? transaction?.comment?.waypoints ?? {waypoint0: {}, waypoint1: {}}, [optimisticWaypoints, transaction]);

Note: We also need to modify the function which checks for duplicate waypoints.

    // Remove keyForList list property before using `isEmpty`.
    const nonEmptyWaypointsCount = useMemo(
        () =>
            Object.keys(waypoints).filter((key) => {
                const {keyForList, ...waypointWithoutKey} = waypoints[key];
                return !isEmpty(waypointWithoutKey);
            }).length,
        [waypoints],
    );

What alternative solutions did you explore? (Optional)

We can use math.random to generate random keys when keyForList or other field are not present, we can use isEmpty for that.

keyExtractor={(item) => (waypoints[item]?.keyForList ?? waypoints[item]?.address ?? '') + item}

Result

waypoint_drag_issue.mp4

@jliexpensify
Copy link
Contributor

I can reproduce, but also have asked the team here if we want to lock down those points, so they can't be dragged.

@jliexpensify jliexpensify added the External Added to denote the issue can be worked on by a contributor label Jun 24, 2024
@melvin-bot melvin-bot bot changed the title Distance - Start and Stop labels do not change when dragging one over another [$250] Distance - Start and Stop labels do not change when dragging one over another Jun 24, 2024
Copy link

melvin-bot bot commented Jun 24, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01b23211c128469d40

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 24, 2024
Copy link

melvin-bot bot commented Jun 24, 2024

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

@jliexpensify
Copy link
Contributor

Ok we are good to look at proposals @abdulrahuman5196 , thanks!

@jliexpensify
Copy link
Contributor

Bump @abdulrahuman5196 for a review please

@abdulrahuman5196
Copy link
Contributor

Hi @jliexpensify Sorry for the delay, I have limited availability at the moment. So unassigning myself. Kindly reassign another C+ for review.

@abdulrahuman5196 abdulrahuman5196 removed their assignment Jun 26, 2024
@hoangzinh
Copy link
Contributor

I can help as a C+ here.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 26, 2024
Copy link

melvin-bot bot commented Jun 26, 2024

📣 @hoangzinh 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@jliexpensify
Copy link
Contributor

All yours @hoangzinh

@hoangzinh
Copy link
Contributor

The draggable list requires key for correctly render the items when dragged

Hi @Krishna2323, thanks for your proposal. Can you explain a little about it? Why does draggable list require keyForList? Thank you.

@Krishna2323
Copy link
Contributor

particularly in scenarios like draggable lists where item positions change, the uniqueness is vital for React to properly track changes in the list. The issue occurring specifically on Android might stem from subtle platform differences in how React Native interacts with each platform's rendering engine.

@hoangzinh, same kind of bug was solved here, we missed this case.

@hoangzinh
Copy link
Contributor

Because the keyExtractor function here already adds item (which is either waypoint0 or waypoint1), therefore it won't be empty.

keyExtractor={(item) => (waypoints[item]?.keyForList ?? waypoints[item]?.address ?? '') + item}

@Krishna2323
Copy link
Contributor

Krishna2323 commented Jun 27, 2024

@hoangzinh, waypoint0 or waypoint1 will always be in the same sequence only the object value will be changed. Thats why we added keyForList

@hoangzinh
Copy link
Contributor

Oh right, @Krishna2323's main solution looks good to me #44153 (comment)

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Jun 28, 2024

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

Copy link

melvin-bot bot commented Jun 28, 2024

📣 @Krishna2323 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot melvin-bot bot added the Overdue label Jul 1, 2024
Copy link

melvin-bot bot commented Jul 1, 2024

@hoangzinh, @jliexpensify, @MonilBhavsar, @Krishna2323 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@Krishna2323
Copy link
Contributor

Will raise PR within 2 days.

@Krishna2323
Copy link
Contributor

@hoangzinh, PR is up but I can't record videos for strict mode, there is warning and I think it is because of strict mode. What should we do? I believe this warning only shows in dev mode.

Monosnap.screencast.2024-07-03.22-19-51.mp4

@Krishna2323
Copy link
Contributor

Krishna2323 commented Jul 3, 2024

Update: It will be fixed after this revert. Will update recordings soon.

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Jul 3, 2024
@Krishna2323
Copy link
Contributor

@hoangzinh, all recordings have been added, you can review the PR.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jul 17, 2024
@melvin-bot melvin-bot bot changed the title [$250] Distance - Start and Stop labels do not change when dragging one over another [HOLD for payment 2024-07-24] [$250] Distance - Start and Stop labels do not change when dragging one over another Jul 17, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jul 17, 2024
Copy link

melvin-bot bot commented Jul 17, 2024

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

Copy link

melvin-bot bot commented Jul 17, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.7-8 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 2024-07-24. 🎊

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

Copy link

melvin-bot bot commented Jul 17, 2024

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:

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

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jul 23, 2024
@jliexpensify
Copy link
Contributor

Payment Summary

Upwork job

@hoangzinh
Copy link
Contributor

BugZero Checklist:

  • The PR that introduced the bug has been identified. Link to the PR: Refactor the money request creation flow #28618
  • 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: @ishpaul777 already commented here on his issue https://github.com/Expensify/App/pull/28618/files#r1631030961
  • 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: ✅ Yes

@hoangzinh
Copy link
Contributor

Regression Test Proposal

  1. Sign in to any Expensify account
  2. Go to FAB > Submit expense > Distance.
  3. Drag the empty Stop row over the empty Start row.
  4. Verify that the Stop label changes to Start and the Start label changes to Stop.

Do we agree 👍 or 👎

@jliexpensify
Copy link
Contributor

Paid and job closed.

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
No open projects
Archived in project
Development

No branches or pull requests

6 participants