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-06-30] [$1000] App crashes on pasting the public room URL again after navigating back #20825

Closed
1 of 6 tasks
kavimuru opened this issue Jun 15, 2023 · 34 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

@kavimuru
Copy link

kavimuru commented Jun 15, 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 dot on web chrome
  2. Create a public room
    3.Send a message in the room (important step)
  3. Copy the URL of the room and paste it in a new incognito window (without signing in)
  4. Click on reply thread icon of the message and notice that it navigates you to the sign in window.
  5. Now click on back button for the browser and see that a empty window page is seen. Now again paste the URL and hit enter
  6. Result: See that the app crashes

Expected Result:

App should not crash on pasting the public room URL again after navigating back

Actual Result:

App crashes on pasting the public room URL again after navigating back

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.3.28-3
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

error-2023-06-14_09.49.41.mp4
Recording.977.mp4

Expensify/Expensify Issue URL:
Issue reported by: @avi-shek-jha
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1686715971306539

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0127842e1a6b2e7f94
  • Upwork Job ID: 1669713173384228864
  • Last Price Increase: 2023-06-16
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jun 15, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 15, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 15, 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

@hungvu193
Copy link
Contributor

hungvu193 commented Jun 15, 2023

Proposal

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

App crashes on pasting the public room URL again after navigating back

What is the root cause of that problem?

We're using getTopmostReportId even when the navigation is not ready, which make the state undefined.
Screen Shot 2023-06-15 at 21 39 42
Now the app will be crashed because the state is undefined and we are checking for state.routes.

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

We can update the original getTopmostReportId function here with an early return

function getTopmostReportId(state) {
    if (!state) {
        return;
    }

or we can update getTopmostReportId inside Navigation.js to this.

const getTopmostReportId = (state = navigationRef.getState()) => {
   if (!navigationRef.isReady()) {
       return;
   }
  return  originalGetTopmostReportId(state);
};

What alternative solutions did you explore? (Optional)

N/A

@daordonez11
Copy link
Contributor

Hey there @sonialiap as discussed in slack I know this issue still has no external tag and might not become external but here is already draft PR that solves the issue, it might help you avoid additional work

@daordonez11
Copy link
Contributor

Proposal

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

Web app crashes when user inputs again the URL after going back from sign in page

What is the root cause of that problem?

After opening the second time the React Navigation library returns an undefined state, which is sent to updateSavedNavigationStateAndLogRoute

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

Instead of having guards in the children methods I recommend having the guard in the parent NavigationRoot.js:

const updateSavedNavigationStateAndLogRoute = (state) => {
        if (!state) {
            return
        }
        navigationStateRef.current = state;
        props.updateCurrentReportId(state);
        parseAndLogRoute(state);
    };

Video of the solution working:
Mobile Browser - 14_6_2023, 14_55_36.webm
New Recording - 14_6_2023, 14_54_41.webm

What alternative solutions did you explore? (Optional)

I began trying a guard in getTopmostReportId but diving into the origin of the issue it is better to use it in the parent in case any additional method is used in updateSavedNavigationStateAndLogRoute
We can also validate with Software Mansion and check if the behavior of receiving and undefined state from the library is correct.

@melvin-bot
Copy link

melvin-bot bot commented Jun 15, 2023

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.

@sonialiap
Copy link
Contributor

Reproducible. Moving to external

Thanks @daordonez11, I'm going to let the C+ review the proposals 👍

@sonialiap sonialiap added the External Added to denote the issue can be worked on by a contributor label Jun 16, 2023
@melvin-bot melvin-bot bot changed the title App crashes on pasting the public room URL again after navigating back [$1000] App crashes on pasting the public room URL again after navigating back Jun 16, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 16, 2023

Job added to Upwork: https://www.upwork.com/jobs/~0127842e1a6b2e7f94

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

melvin-bot bot commented Jun 16, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 16, 2023

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

@sonialiap
Copy link
Contributor

@mollfpr there was some discussion in slack that may influence how you think we should handle this - thread

@mountiny
Copy link
Contributor

@daordonez11 wouldnt this be solved also using your solution here? #20558

I think if yes, we can put it on hold. But otherwise, also lets get this reviewed by @WoLewicki too, I think making this safer is a good approach @mollfpr

@daordonez11
Copy link
Contributor

daordonez11 commented Jun 16, 2023

Indeed it might @mountiny , yet there might be other scenarios where state is undefined that we don't know yet, and since #20558 was on hold I created a solution specific to avoid the app crash. Since react navigator returns de hydratedState undefined I'm not sure if other scenarios could trigger it. Still having the guard in updateSavedNavigationStateAndLogRoute might be safer for the future

@melvin-bot melvin-bot bot added the Overdue label Jun 19, 2023
@mountiny mountiny moved this to Review Proposals in Navigation Refactor Follow-ups Jun 19, 2023
@mountiny mountiny self-assigned this Jun 19, 2023
@mountiny
Copy link
Contributor

Assigning this once since its navigation related.

@melvin-bot melvin-bot bot removed the Overdue label Jun 19, 2023
@adamgrzybowski
Copy link
Contributor

Still having the guard in updateSavedNavigationStateAndLogRoute might be safer for the future

It's so weird that the state for onStateChange can be undefined but I agree with the comment above. It looks like the safest option.

@mountiny
Copy link
Contributor

@hungvu193 thanks for your proposal, but i think @daordonez11 solution is more broad/ general and can cover more cases of this error, so I am going with his proposal.

@mountiny mountiny moved this from Review Proposals to Review External PR in Navigation Refactor Follow-ups Jun 19, 2023
@daordonez11
Copy link
Contributor

Hey there @mountiny PR Ready: #20772

@melvin-bot melvin-bot bot added the Reviewing Has a PR in review label Jun 20, 2023
@mountiny
Copy link
Contributor

Thanks!

@melvin-bot
Copy link

melvin-bot bot commented Jun 21, 2023

🎯 ⚡️ Woah @mollfpr / @daordonez11, great job pushing this forwards! ⚡️

The pull request got merged within 3 working days of assignment, so this job is eligible for a 50% #urgency bonus 🎉

  • when @daordonez11 got assigned: 2023-06-19 11:19:01 Z
  • when the PR got merged: 2023-06-21 10:27:33 UTC

On to the next one 🚀

@mountiny
Copy link
Contributor

@daordonez11 congrats on your first merged PR 🎉

@daordonez11
Copy link
Contributor

Thanks @mountiny 💪🏼 first step on my way to C+ and help building expensify

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels Jun 23, 2023
@melvin-bot melvin-bot bot changed the title [$1000] App crashes on pasting the public room URL again after navigating back [HOLD for payment 2023-06-30] [$1000] App crashes on pasting the public room URL again after navigating back Jun 23, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jun 23, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 23, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 23, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.31-3 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-06-30. 🎊

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

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 Jun 23, 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:

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

@mollfpr
Copy link
Contributor

mollfpr commented Jun 29, 2023

[@mollfpr] The PR that introduced the bug has been identified. Link to the PR:

#16581

[@mollfpr] 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:

https://github.com/Expensify/App/pull/16581/files#r1246040157

[@mollfpr] 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:

This is a regression for our navigation reboot, so the regression step should be enough.

[@mollfpr] Determine if we should create a regression test for this bug.
[@mollfpr] 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.

  1. Go to staging dot on web chrome
  2. Create a public room
  3. Send a message in the room (important step)
  4. Copy the URL of the room and paste it into a new incognito window (without signing in)
  5. Click on the reply thread icon of the message and notice that it navigates you to the sign-in window.
  6. Now click on the back button for the browser and see that an empty window page is seen. Now again, paste the URL and hit enter
  7. Verify the app is not crash
  8. 👍 or 👎

@parasharrajat parasharrajat moved this from Review External PR to In Progress in Navigation Refactor Follow-ups Jun 29, 2023
@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Jun 30, 2023
@sonialiap
Copy link
Contributor

Timeline:
June 14 9:57pm opened
June 21 12:27pm merged
Days: about 3.5
No merge bonus

@melvin-bot melvin-bot bot removed the Overdue label Jul 3, 2023
@sonialiap
Copy link
Contributor

sonialiap commented Jul 3, 2023

@avi-shek-jha offer sent for report - paid ✔️
@daordonez11 offer sent for fix (+bonus) - paid ✔️
@mollfpr offer sent for review (+bonus) - paid ✔️

@daordonez11
Copy link
Contributor

Hey @sonialiap isn't urgency bonus based assignation? I was assigned on Wednesday 19 and merged by Friday 21 it took only 2 business days. I think it does apply in this case.

@mountiny mountiny moved this from In Progress to Done in Navigation Refactor Follow-ups Jul 4, 2023
@mountiny
Copy link
Contributor

mountiny commented Jul 4, 2023

@sonialiap the bonus should apply here, would you be able to update the contracts please? thanks!

@sonialiap
Copy link
Contributor

Thanks for the correction. The bonus is applied on top of the contract so no need to amend them. Issuing payment with the bonus now ⏳ 💰

@sonialiap
Copy link
Contributor

@daordonez11 please accept the offer. Bonus is applied during payment after the offer has been accepted :)

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
Development

No branches or pull requests

7 participants