Skip to content

[$250] WS - App crashes when changing workspace ID to invalid ID while distance rate RHP is open #40481

Closed

Description

@kbecciv

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: 1.4.63-0
Reproducible in staging?: y
Reproducible in production?: y
Issue found when executing PR: #36409
Issue reported by: Applause - Internal Team

Action Performed:

  1. Navigate to staging.new.expensify.com
  2. Create a workspace
  3. Click on More features and turn on distance rates
  4. Open Distance rates settings
  5. Click on one distance rate to open the RHP
  6. Click on the URL and change the workspace ID to an invalid set of strings

Expected Result:

Not found view renders

Actual Result:

App crashes

Workaround:

n/a

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

Add any screenshot/video evidence

Bug6453708_1713450539309.bandicam_2024-04-18_17-21-36-157.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~012a487426fc875ae6
  • Upwork Job ID: 1781338802987253760
  • Last Price Increase: 2024-04-19
  • Automatic offers:
    • ishpaul777 | Reviewer | 0
    • Nodebrute | Contributor | 0

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Apr 18, 2024
  2. melvin-bot commented on Apr 18, 2024

    @melvin-bot

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

  3. kbecciv commented on Apr 18, 2024

    @kbecciv
    Author

    We think that this bug might be related to #wave-collect - Release 1

  4. kbecciv commented on Apr 18, 2024

    @kbecciv
    Author

    @bfitzexpensify FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors.

  5. Nodebrute commented on Apr 18, 2024

    @Nodebrute
    Contributor

    Proposal

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

    App crashes when changing workspace ID to invalid ID while distance rate RHP is open

    What is the root cause of that problem?

    We need to improve our usage of optional chaining in this file, as currently, many values are left undefined PolicyDistanceRateDetailsPage.tsx

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

    We should do proper optional chaining in this file.
    For example (Pseudocode)

    const currency = rate?.currency ?? CONST.CURRENCY.USD;
    const canDeleteRate = Object.values(customUnit?.rates ?? {}).filter((distanceRate) => distanceRate?.enabled).length > 1 || !rate?.enabled;
    const canDisableRate = Object.values(customUnit?.rates ?? {}).filter((distanceRate) => distanceRate?.enabled).length > 1;
    

    We should address and fix the issues present throughout the entirety of this file.

    What alternative solutions did you explore? (Optional)

  6. ZhenjaHorbach commented on Apr 18, 2024

    @ZhenjaHorbach
    Contributor

    Regression from this PR #38060

    Proposal

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

    WS - App crashes when changing workspace ID to invalid ID while distance rate RHP is open

    What is the root cause of that problem?

    The problem is due to the fact that during the creation of the PR, not all cases were taken into account

    https://github.com/Expensify/App/pull/38237/files#diff-7e73657dfb914a3edb6449a7b19dfe303dd7c1c21e3cfe4e8c6318c0411575e0R46-R51

    As a result, we have cases when we try to get a value from undefined

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

    To fix this issue we can check new components and add optional chains wherever needed

    In fact, looking at the new changes, this is not the only component that needs refactoring

    We have a similar situation on PolicyDistanceRateEditPage for example

    d9e986d#diff-c4dba2a501b3bb84d9f473b51674f7bcb32b5518cd80d1ca653bc56703560d79R43-R48

    What alternative solutions did you explore? (Optional)

    NA

  7. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Apr 19, 2024
  8. melvin-bot commented on Apr 19, 2024

    @melvin-bot
  9. changed the title [-]WS - App crashes when changing workspace ID to invalid ID while distance rate RHP is open[/-] [+][$250] WS - App crashes when changing workspace ID to invalid ID while distance rate RHP is open[/+] on Apr 19, 2024
  10. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Apr 19, 2024
  11. melvin-bot commented on Apr 19, 2024

    @melvin-bot

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

  12. 21 remaining items

  13. Nodebrute commented on Apr 29, 2024

    @Nodebrute
    Contributor

    @ishpaul777 Sorry for the delay. I'm working on it, and it will be ready in a few hours.

  14. Nodebrute commented on Apr 30, 2024

    @Nodebrute
    Contributor

    @ishpaul777 Hey, the PR is ready for review.

  15. AndrewGable commented on May 20, 2024

    @AndrewGable
    Contributor

    Seems like there is one more instance of this: #41293 (comment)

    Can we add this as a follow up to this issue and make a new PR with the fix? Thanks!

  16. ishpaul777 commented on May 22, 2024

    @ishpaul777
    Contributor

    Hey @Nodebrute, Would you be able to raise a new PR?

  17. Nodebrute commented on May 22, 2024

    @Nodebrute
    Contributor

    Hey @ishpaul777 do we have a regression?

  18. ishpaul777 commented on May 22, 2024

    @ishpaul777
    Contributor

    Sadly the issue was reintroduced by another PR

  19. sobitneupane commented on May 23, 2024

    @sobitneupane
    Contributor

    We addressed the issue in #42502 PR

  20. bfitzexpensify commented on May 30, 2024

    @bfitzexpensify
    Contributor

    OK, seems like if this is resolved via #42502, which is connected to #41594, then we can close this out.

  21. Nodebrute commented on May 30, 2024

    @Nodebrute
    Contributor

    @bfitzexpensify Hey, the payment is due here. Also, these are two separate issues. This was #42502 created to deal with a regression caused in this issue #41594

  22. bfitzexpensify commented on May 30, 2024

    @bfitzexpensify
    Contributor

    Gotcha - offers sent @Nodebrute @ishpaul777

  23. bfitzexpensify commented on May 31, 2024

    @bfitzexpensify
    Contributor

    Payments complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in reviewWeeklyKSv2

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions