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] [Distance] - Start and Finish data does not remain when user change to Manual/Scan #26716

Closed
6 tasks done
lanitochka17 opened this issue Sep 4, 2023 · 16 comments
Closed
6 tasks done
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

@lanitochka17
Copy link

lanitochka17 commented Sep 4, 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!


Issue found when executing PR #26622

Action Performed:

  1. Open New Expensify app
  2. Tap FAB button
  3. Tap Request money
  4. Tap Distance
  5. Enter Start address
  6. Enter Finish address
  7. Navigate to Scan/Manual tab
  8. Turn back to Distance tab

Expected Result:

Entered Start and Finish data should remain when user change to Manual/Scan

Actual Result:

Start and Finish data does not remain when user change to Manual/Scan

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
  • Windows / Chrome

Version Number: 1.3.63-0

Reproducible in staging?: Yes

Reproducible in production?: Yes

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

Bug6188324_az_recorder_20230904_204906.mp4

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team

Slack conversation:

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~013db7c954b21603ab
  • Upwork Job ID: 1698830860091473920
  • Last Price Increase: 2023-09-04
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 4, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 4, 2023

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

@melvin-bot
Copy link

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

@adelekennedy adelekennedy added the External Added to denote the issue can be worked on by a contributor label Sep 4, 2023
@melvin-bot melvin-bot bot changed the title Distance - Start and Finish data does not remain when user change to Manual/Scan [$500] Distance - Start and Finish data does not remain when user change to Manual/Scan Sep 4, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 4, 2023

Job added to Upwork: https://www.upwork.com/jobs/~013db7c954b21603ab

@adelekennedy
Copy link

reproduced!

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

melvin-bot bot commented Sep 4, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 4, 2023

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

@DylanDylann
Copy link
Contributor

DylanDylann commented Sep 5, 2023

Proposal

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

Distance - Start and Finish data does not remain when user change to Manual/Scan

What is the root cause of that problem?

After selecting the location (start and finish) we save it in ONYX in the transcation_{transactionID} field. But when selecting another tab we reset the field

IOU.resetMoneyRequestInfo(moneyRequestID);

It causes that the transactionID field in iou will be empty. Then, when coming back the new transaction will be created

useEffect(() => {
if (iou.transactionID) {
return;
}
IOU.createEmptyTransaction();
}, [iou.transactionID]);

The old transaction with the old value will not be used anymore

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

When selecting another request tab, we should keep transactionID in iou field. So that, the new transaction will be not created by this logic

useEffect(() => {
if (iou.transactionID) {
return;
}
IOU.createEmptyTransaction();
}, [iou.transactionID]);

To do that, in resetMoneyRequestInfo function we can define transactionID param with the default value is ''.
And in here

IOU.resetMoneyRequestInfo(moneyRequestID);

we pass transactionID to this fucntion

        IOU.resetMoneyRequestInfo(moneyRequestID, lodashGet(props.iou, 'transactionID', ''));

What alternative solutions did you explore? (Optional)

We can create a new field on ONYX called draftTransaction to save the location that the user selects.

Transaction.saveWaypoint(transactionID, waypointIndex, waypoint);

Here we will save to draftTransaction instead of transactions_{transactionID}, we only save to transactions_{transactionID} when the user clicks the Next button. This is the way we did in task page

@tienifr
Copy link
Contributor

tienifr commented Sep 5, 2023

Proposal

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

Distance - Start and Finish data does not remain when user change to Manual/Scan

What is the root cause of that problem?

In

const resetMoneyRequestInfo = () => {
const moneyRequestID = `${iouType}${reportID}`;
IOU.resetMoneyRequestInfo(moneyRequestID);
};

We have the logic to reset request info when users change page. Unfortunately, we don't have the logic to check shouldReset as what we did in other pages like MoneyRequestMerchantPage,...

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

add logic check shouldReset in resetMoneyRequestInfo function like below

    const resetMoneyRequestInfo = () => {
        const moneyRequestID = `${iouType}${reportID}`;
        const shouldReset = props.iou.id !== moneyRequestID;
        if(shouldReset){
            IOU.resetMoneyRequestInfo(moneyRequestID);
        }
    };

@DylanDylann
Copy link
Contributor

updated proposal: Adding alternative solution

@studentofcoding
Copy link
Contributor

studentofcoding commented Sep 5, 2023

Proposal

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

Distance - Start and Finish data does not remain when user change to Manual/Scan

What is the root cause of that problem?

We reset the Request Info in resetMoneyRequestInfo, but did not give the condition to check if the current tab is the same as the new tab or not run & resetMoneyRequestInfo based on that condition

const resetMoneyRequestInfo = () => {
const moneyRequestID = `${iouType}${reportID}`;
IOU.resetMoneyRequestInfo(moneyRequestID);
};

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

Both the solution of @tienifr and @DylanDylann is similar, but will not satisfy the Expected behavior & we didn't really need to add and track props.iou.

I also imagine that we only want this behaviour on Distance, and the value will reset on others Tab, therefore what we should do instead, is handle it simply via condition on resetMoneyRequestInfo & onTabPress

  • resetMoneyRequestInfo
const resetMoneyRequestInfo = (currentTab) => {
        if (currentTab === CONST.TAB.DISTANCE) {
            return;
        }
    
        const moneyRequestID = `${iouType}${reportID}`;
        IOU.resetMoneyRequestInfo(moneyRequestID);
};
  • onTabPress
<TabSelector
          state={state}
           navigation={navigation}
           onTabPress={(newTab) => {
                   if (props.selectedTab !== newTab) {
                           return;
                   }
                   resetMoneyRequestInfo(newTab);
            }
            position={position}
/>

Result

tab_changes.mp4

cc: @narefyev91 @adelekennedy

@narefyev91
Copy link
Contributor

@adelekennedy are we sure that we should keep values? We have 3 options to request money - either manually or scan or distance - navigating between tabs - means that user should not expect saving redundant information. Maybe i'm wrong but needs to clarify

@joh42
Copy link
Contributor

joh42 commented Sep 5, 2023

I also thought this was expected behavior when I encountered it Actually since the amount persists on the manual tab, the expected behavior might be saving the waypoints

@studentofcoding
Copy link
Contributor

I can imagine that the user would benefit from keeping the waypoint value (in case let say they inputted 5 points, and accidently switch from Distance to another tab)

In case on another tab, its make sense to keep the reselt to default behaviour as it's a one item (time) input

Additional note: In my proposal, I've laid out the details on those 2 conditions

@narefyev91 @adelekennedy

@narefyev91
Copy link
Contributor

I also thought this was expected behavior when I encountered it Actually since the amount persists on the manual tab, the expected behavior might be saving the waypoints

Amount exists only if you not do any interaction on other tabs - for example choosing start/end on distance tab will reset amount of manual. We need to have correct understanding how it should be working @adelekennedy

@lanitochka17 lanitochka17 changed the title [$500] Distance - Start and Finish data does not remain when user change to Manual/Scan [$500] [Distance] - Start and Finish data does not remain when user change to Manual/Scan Sep 5, 2023
@situchan
Copy link
Contributor

situchan commented Sep 5, 2023

This is intentional - #26579 (comment)

@adelekennedy
Copy link

Let's close - looking back at this I hit external too soon without covering expected behavior

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

8 participants