Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.1k stars 2.6k forks source link

[$125] [Search v1] Crash when opening search page #44396

Open m-natarajan opened 6 days ago

m-natarajan commented 6 days ago

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: Reproducible in staging?: Needs reproduction Reproducible in production?: Needs reproduction 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 Expensify/Expensify Issue URL: Issue reported by: @roryabraham Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1719267975652129

Action Performed:

  1. Go to staging.new.expensify.com or open the app in iOS
  2. Tap/click search icon from the bottom menu

Expected Result:

Search page opens

Actual Result:

App crash on opening search page

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

Screenshots/Videos

Screenshot 2024-06-25 at 12 42 02 PM

Add any screenshot/video evidence

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0102a0367add306853
  • Upwork Job ID: 1805638862559138604
  • Last Price Increase: 2024-06-25
  • Automatic offers:
    • abdulrahuman5196 | Reviewer | 102873501
    • neonbhai | Contributor | 102873504
Issue OwnerCurrent Issue Owner: @abdulrahuman5196
melvin-bot[bot] commented 6 days ago

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

MelvinBot commented 6 days ago

This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989

Kicu commented 6 days ago

@m-natarajan Please try cleaning your Onyx cache, rerun then app and tell us if this fixes the problem. This solution worked for my case.

If yes then I believe this should not be a big problem, unfortunately we're still in development mode for the Search features so small bumps like this one might happen.

CC @luacmartins for visibility

neonbhai commented 6 days ago

Proposal

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

App Crash when opening search page

What is the root cause of that problem?

We are accessing shouldShowCategoryColumn without using optional chaining operator. This causes a crash sometimes if the network is slow and SearchResults object has not fully loaded.

We should use optionalChaining when accessing this property:

metadata?.columnsToShow?.shouldShowCategoryColumn, 

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

We will use optionalChaining when acessing shouldShowCategoryColumn in these places: https://github.com/Expensify/App/blob/2f688ad31969f148b18a3793b057b31c4f02aec7/src/libs/SearchUtils.ts#L141

https://github.com/Expensify/App/blob/2f688ad31969f148b18a3793b057b31c4f02aec7/src/libs/SearchUtils.ts#L188

https://github.com/Expensify/App/blob/2f688ad31969f148b18a3793b057b31c4f02aec7/src/components/SelectionList/SearchTableHeader.tsx#L56

Additionally

We will optionalChaining when accessing shouldShowTagColumn and shouldShowTaxColumn here:

https://github.com/Expensify/App/blob/2f688ad31969f148b18a3793b057b31c4f02aec7/src/libs/SearchUtils.ts#L142

https://github.com/Expensify/App/blob/2f688ad31969f148b18a3793b057b31c4f02aec7/src/libs/SearchUtils.ts#L189

https://github.com/Expensify/App/blob/2f688ad31969f148b18a3793b057b31c4f02aec7/src/components/SelectionList/SearchTableHeader.tsx#L61

https://github.com/Expensify/App/blob/2f688ad31969f148b18a3793b057b31c4f02aec7/src/libs/SearchUtils.ts#L143

https://github.com/Expensify/App/blob/2f688ad31969f148b18a3793b057b31c4f02aec7/src/libs/SearchUtils.ts#L190

https://github.com/Expensify/App/blob/2f688ad31969f148b18a3793b057b31c4f02aec7/src/components/SelectionList/SearchTableHeader.tsx#L66

neonbhai commented 6 days ago

If yes then I believe this should not be a big problem, unfortunately we're still in development mode for the Search features so small bumps like this one might happen.

Agree, but I think we should add optional chaining as a sanity check for scenarios like these, so the app doesn't crash!

melvin-bot[bot] commented 5 days ago

Job added to Upwork: https://www.upwork.com/jobs/~0102a0367add306853

melvin-bot[bot] commented 5 days ago

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

melvin-bot[bot] commented 5 days ago

Upwork job price has been updated to $125

melvin-bot[bot] commented 5 days ago

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

Offer link Upwork job

luacmartins commented 5 days ago

@neonbhai please put up a PR to add optional chaining

melvin-bot[bot] commented 5 days ago

📣 @neonbhai 🎉 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 📖

luacmartins commented 3 days ago

@neonbhai how's the PR coming along?

neonbhai commented 3 days ago

PR ready for review!