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 #17662] [$1000] Double sliding animation on Send/Request money #17710

Closed
1 of 6 tasks
kavimuru opened this issue Apr 20, 2023 · 50 comments
Closed
1 of 6 tasks

[HOLD #17662] [$1000] Double sliding animation on Send/Request money #17710

kavimuru opened this issue Apr 20, 2023 · 50 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. 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 Weekly KSv2

Comments

@kavimuru
Copy link

kavimuru commented Apr 20, 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. Go to staging web app
  2. go to send/request money either from a chat or from the big green plus icon

Additionally:

  1. Request money from the global create
  2. Notice that the confirmation page slides from right to left (0:06 in the video), which is correct
  3. Now, request money from within a chat
  4. Notice that the confirmation page slides from left to right (0:11 in the video), which is wrong
bug.mov

Expected results:

Single sliding animation like in other components like new chat, new group

Actual results:

Double sliding animation

Confirmation page animation should be consistent.

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

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

bandicam.2023-04-19.14-36-34-321.mp4
Recording.284.mp4

Expensify/Expensify Issue URL:
Issue reported by: @chiragxarora
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1681895092997009

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01e04e92b347a09af4
  • Upwork Job ID: 1649155886500388864
  • Last Price Increase: 2023-04-27
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Apr 20, 2023
@MelvinBot
Copy link

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

@MelvinBot
Copy link

MelvinBot commented Apr 20, 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

@PrashantMangukiya
Copy link
Contributor

@mountiny @luacmartins Just sharing my thoughts for this.

It looks like this is regression from this PR #16919 Which modified src/pages/iou/MoneyRequestModal.js line 116 from
this const [previousStepIndex, setPreviousStepIndex] = useState(0); to
this const [previousStepIndex, setPreviousStepIndex] = useState(-1);

So this the root cause of this problem.

If we set previousStepIndex default value to 0 it will solve the problem. I tested it. Thank you.

@mountiny
Copy link
Contributor

Yeah this is a valid problem

@mountiny mountiny added the External Added to denote the issue can be worked on by a contributor label Apr 20, 2023
@melvin-bot melvin-bot bot changed the title Double sliding animation on Send/Request money [$1000] Double sliding animation on Send/Request money Apr 20, 2023
@MelvinBot
Copy link

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

@MelvinBot
Copy link

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

@MelvinBot
Copy link

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

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

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

@PrashantMangukiya
Copy link
Contributor

Proposal

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

Whenever go to send/request money flow, it will show sliding animation two times i.e. first time when initial loader shows, and thereafter when transition end.

What is the root cause of that problem?

We can see at line 375 it shows <FullScreenLoadingIndicator /> until didScreenTransitionEnd thereafter once transition end it will render content based on the 376 and <AnimatedStep> component load based on the steps and using direction.

{!didScreenTransitionEnd && <FullScreenLoadingIndicator />}
{didScreenTransitionEnd && (
<>
{currentStep === Steps.MoneyRequestAmount && (
<AnimatedStep
direction={direction}

During component load here is the state for previousStepIndex and currentStepIndex

const [previousStepIndex, setPreviousStepIndex] = useState(-1);
const [currentStepIndex, setCurrentStepIndex] = useState(0);

Directions are decided based on the functions below:

const direction = useMemo(() => {
// If we're going to the "amount" step from the "confirm" step, push it in and pop it out like we're moving
// forward instead of backwards.
const amountIndex = _.indexOf(steps, Steps.MoneyRequestAmount);
const confirmIndex = _.indexOf(steps, Steps.MoneyRequestConfirm);
if (previousStepIndex === confirmIndex && currentStepIndex === amountIndex) {
return 'in';
}
if (previousStepIndex === amountIndex && currentStepIndex === confirmIndex) {
return 'out';
}
if (previousStepIndex < currentStepIndex) {
return 'in';
}
if (previousStepIndex > currentStepIndex) {
return 'out';
}
// Doesn't animate the step when first opening the modal
if (previousStepIndex === currentStepIndex) {
return null;
}
}, [previousStepIndex, currentStepIndex, steps]);

So here during component load it will trigger the third condition i.e. line 178 as shown in code above. So this is the root cause of the problem.

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

We can to set previousStepIndex to 0 as show below, it will solve the issue.

// const [previousStepIndex, setPreviousStepIndex] = useState(-1); //  Old
const [previousStepIndex, setPreviousStepIndex] = useState(0);  // Updated

This will solve the issue as shown in result video.

What alternative solutions did you explore? (Optional)

We can keep previousStepIndex and currentStepIndex value as it and add if condition at position shown below, and remove if from last as shown in code below:

const [previousStepIndex, setPreviousStepIndex] = useState(-1);
const [currentStepIndex, setCurrentStepIndex] = useState(0);

const direction = useMemo(() => {
    ...
    if (previousStepIndex === amountIndex && currentStepIndex === confirmIndex) {
        return 'out';
    }
    if (previousStepIndex === -1 && currentStepIndex === 0) { // *** Add if condition here ***
        return null;
    }
    ...
    // Doesn't animate the step when first opening the modal
    // if (previousStepIndex === currentStepIndex) { // *** Remove this if condition as it is not need ***
    //     return null;
    // }
}, [previousStepIndex, currentStepIndex, steps]);
Results
Web.mp4

@luacmartins
Copy link
Contributor

The confirmation page animation is also wrong it slides from the right. That should only be the behavior when editing a field.

@MitchExpensify
Copy link
Contributor

@chiragxarora mind applying to the Upwork job for eventual reporting payment? Thank you!

@chiragxarora
Copy link
Contributor

chiragxarora commented Apr 20, 2023

Hi @MitchExpensify
Is the job link same for both reporter and solver?
Do I have to write anything specific in the proposal?
This is my first one here, have no idea

@MitchExpensify
Copy link
Contributor

Nope just apply so I know your Upwork profile, easy! @chiragxarora 👍

@chiragxarora
Copy link
Contributor

Done!

@s77rt
Copy link
Contributor

s77rt commented Apr 21, 2023

@PrashantMangukiya Thanks for the proposal. Your RCA makes sense. But I think we need to understand why such change was required.

@yuwenmemon Was there any reason to change the default previousStepIndex value from 0 to -1. Or was that done just to be "correct" and if so any reason why we didn't use null instead of -1.

@s77rt
Copy link
Contributor

s77rt commented Apr 21, 2023

@luacmartins I'm not sure I understood what you are referring to exactly, can you please attach a video and edit the OP if you think we should handle that too.
Edit: I got it, but need to initiate the process from the chat. Please update issue body..

@dukenv0307
Copy link
Contributor

Proposal

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

There're 2 problems here regarding the animation:

  1. Double sliding animation on Send/Request Money
  2. The confirmation page animation is wrong when navigation from the MoneyRequestAmount to the MoneyRequestConfirm page (mentioned here)

What is the root cause of that problem?

  1. Here
    if (previousStepIndex < currentStepIndex) {
    where we set animation direction to in when previousStepIndex < currentStepIndex, the condition is also true when the previousStepIndex is -1 and currentStepIndex is 0 which is the initial state of the page, causing the double animation.
  2. Here https://github.com/Expensify/App/blob/214658eca48517fc3c2d087f569187ddec173ee7/src/pages/iou/MoneyRequestModal.js#L171-174 and here
    if (previousStepIndex === amountIndex && currentStepIndex === confirmIndex) {
    we're using custom condition to handle the case of navigation from the MoneyRequestConfirm page to the MoneyRequestAmount page when editing the amount. So basically since the step of MoneyRequestAmount is 0, step of MoneyRequestConfirm is 1, if we don't have this condition, when we navigate from the confirm page to the amount page to try to edit the amount, it will show backwards animation. However that condition breaks the animation of forward navigation from amount page to confirm page initially (not editing).

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

  1. The direction is only relevant if we go from 1 page to another page, meaning we have previousStepIndex >= 0 ( previousStepIndex = -1 means that there's no previous page)
    So we need to check if previousStepIndex < 0 in the beginning of
    const direction = useMemo(() => {
    .

If true, it will return null so there's no animation, and the outdated condition here

if (previousStepIndex === currentStepIndex) {
can be removed since it's not possible for previousStepIndex to be equal to currentStepIndex.

We cannot set previousStepIndex to 0 initially because that will break the amount editing flow. As we can see here

if (currentStepIndex <= 0 && previousStepIndex < 0) {
, previousStepIndex -1 is relied on in the navigation logic.

  1. To fix this we need to rethink how we're handling the edit amount flow

Currently what we do is:

  • Both the set amount and edit amount are step 0
  • If we navigate from confirm page to amount page to edit the amount, by right we're moving forward in the navigation but in code we're actually navigating back to step 0. And then we add a number of non-straight-forward conditions like here and here to show the correct animation & navigation. It can be interpreted as "navigating from step 1 to step 0 but please use forward rather than backward animation", ... which is error prone.

I suspect the reason for that is that we're using the same UI for both steps.

We need to change to:

  • edit amount and set amount are 2 separate steps (edit amount will be a new step after confirm page )
  • In
    {currentStep === Steps.MoneyRequestAmount && (
    we'll show the same UI for both the edit amount and set amount steps
  • Then we can remove all the workaround-ish manipulation for the edit amount case, for example here and here, since when navigating from the confirm page to edit amount page, it's regular forward navigation so it will work with regular animation direction and navigation logic
  • In here if it's edit amount step we'll go back, if it's set amount step we'll go to next page.

What alternative solutions did you explore? (Optional)

NA

@MelvinBot
Copy link

Looks like something related to react-navigation may have been mentioned in this issue discussion.

As a reminder, please make sure that all proposals are not workarounds and that any and all attempt to fix the issue holistically have been made before proceeding with a solution. Proposals to change our DeprecatedCustomActions.js files should not be accepted.

Feel free to drop a note in #expensify-open-source with any questions.

@luacmartins
Copy link
Contributor

@s77rt here are the steps to reproduce and a video. If we agree that it's an issue, I can edit the OP to include this.

  1. Request money from the global create
  2. Notice that the confirmation page slides from right to left (0:06 in the video), which is correct
  3. Now, request money from within a chat
  4. Notice that the confirmation page slides from left to right (0:11 in the video), which is wrong
bug.mov

@s77rt
Copy link
Contributor

s77rt commented Apr 21, 2023

@luacmartins Yes, let's add that.

@luacmartins
Copy link
Contributor

Cool, added to the OP.

@melvin-bot melvin-bot bot added the Overdue label May 1, 2023
@s77rt
Copy link
Contributor

s77rt commented May 1, 2023

Still on hold.

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels May 1, 2023
@puneetlath puneetlath added Weekly KSv2 and removed Daily KSv2 labels May 3, 2023
@melvin-bot melvin-bot bot removed the Overdue label May 3, 2023
@puneetlath
Copy link
Contributor

Moving to Weekly while it's on hold.

@melvin-bot melvin-bot bot added the Overdue label May 12, 2023
@s77rt
Copy link
Contributor

s77rt commented May 12, 2023

Still on hold.

@melvin-bot melvin-bot bot removed the Overdue label May 12, 2023
@melvin-bot melvin-bot bot added the Overdue label May 22, 2023
@s77rt
Copy link
Contributor

s77rt commented May 22, 2023

Still on hold.

@melvin-bot melvin-bot bot removed the Overdue label May 22, 2023
@melvin-bot melvin-bot bot added the Overdue label May 30, 2023
@s77rt
Copy link
Contributor

s77rt commented May 30, 2023

Same ^

@melvin-bot melvin-bot bot removed the Overdue label May 30, 2023
@melvin-bot melvin-bot bot added the Overdue label Jun 8, 2023
@s77rt
Copy link
Contributor

s77rt commented Jun 8, 2023

Same ^

@melvin-bot melvin-bot bot removed the Overdue label Jun 8, 2023
@melvin-bot melvin-bot bot added the Overdue label Jun 19, 2023
@s77rt
Copy link
Contributor

s77rt commented Jun 19, 2023

Same ^ but getting close

@melvin-bot melvin-bot bot removed the Overdue label Jun 19, 2023
@puneetlath puneetlath removed their assignment Jun 20, 2023
@puneetlath
Copy link
Contributor

Going to un-assign myself for now, per the new process.

@s77rt
Copy link
Contributor

s77rt commented Jun 24, 2023

#17662 is resolved. This issue is no longer reproducible. Can we close this? (or do we need to pay the bug reporter in this case?)

@chiragxarora
Copy link
Contributor

Yes :)

@chiragxarora
Copy link
Contributor

@MitchExpensify this is fixed now

@MitchExpensify
Copy link
Contributor

Reporting bonus paid! Thanks everyone

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

No branches or pull requests