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.03k stars 2.54k forks source link

[Search v1] Remove multiple API calls and clean up const #42335

Closed WojtekBoman closed 5 days ago

WojtekBoman commented 2 weeks ago

Details

This PR fixes calling /Search multiple times. Now all parameters sent in the /Search request are stored in route.params, this prevents the Search component from being re-rendered. This PR includes also a fix for useActiveWorkspaceFromNavigationState hook, the additional check has been added to return undefined instead of the empty string, it fixes the issue with displaying the placeholder in the Workspace Switcher instead of the Expensify logo.

https://github.com/Expensify/App/assets/47774969/048c3974-b01a-45bb-a477-9a880079fac1

Fixed Issues

$ https://github.com/Expensify/App/issues/42177 PROPOSAL:

Tests

Offline tests

QA Steps

PR Author Checklist

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari https://github.com/Expensify/App/assets/47774969/e06fb6b9-db8f-4b82-bac7-13441985fcbc
MacOS: Desktop https://github.com/Expensify/App/assets/47774969/5c6f96c6-978b-4736-b5e0-40437e12d80b
melvin-bot[bot] commented 2 weeks ago

@ahmedGaber93 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

ahmedGaber93 commented 1 week ago

Reviewer Checklist

Screenshots/Videos

Android: Native https://github.com/Expensify/App/assets/41129870/66bfbf61-02af-4e66-ab18-85ae4a7bd715
Android: mWeb Chrome https://github.com/Expensify/App/assets/41129870/59f37d6c-89e7-40fe-82ac-bb943abdff14
iOS: Native https://github.com/Expensify/App/assets/41129870/fe8f7375-de39-42a0-983a-34d8f02adad4
iOS: mWeb Safari https://github.com/Expensify/App/assets/41129870/5c39b1ce-17c3-4e23-ae64-7aaeabe9ec49
MacOS: Chrome / Safari https://github.com/Expensify/App/assets/41129870/07f8c50c-a006-411e-9d39-daabea6a8263
MacOS: Desktop https://github.com/Expensify/App/assets/41129870/da9b9a57-d8b6-47a3-b3c1-9629322f7d57
ahmedGaber93 commented 1 week ago

Fixed issues:

ahmedGaber93 commented 1 week ago

I faced this issue while recording videos. But because it already reproduced in latest main. I continue testing the PR issues and ignore it.

https://github.com/Expensify/App/assets/41129870/1c2ea0a1-95fe-47ea-bbb6-409bc3d267f2

ahmedGaber93 commented 1 week ago

@WojtekBoman we still need to fix deeplink issue https://github.com/Expensify/App/pull/41769#issuecomment-2103446491 that mentioned here https://github.com/Expensify/App/pull/41769#pullrequestreview-2050573677

ahmedGaber93 commented 1 week ago

@WojtekBoman deeplinks now works good 👍. But I found this issue after open search page from deeplink.

Bug: workspace-switcher not highlight the active workspace after open search page from deeplink

  1. open deeplink npx uri-scheme open 'new-expensify://search/all?policyIDs=YOUR_WORKSPACE_ID' --android
  2. click on workspace-switcher icon.

Workspace-switcher not highlight the active workspace, and instead it highlights the Expensify choice.

https://github.com/Expensify/App/assets/41129870/e3e1ba3f-7f74-42ca-9369-19af65059906

ahmedGaber93 commented 1 week ago

@adamgrzybowski I am not sure if remove forced up is related to this PR or not. Can you help me to test it by adding some test steps for it if it is a global refactor?

adamgrzybowski commented 1 week ago

@ahmedGaber93 As you may see there are some changes in the linkTo file. I used this opportunity to clean this function a little and split it into files.

While working on it, I noticed that the FORCE_UP and UP do exactly the same thing. At some point when we were working on the navigation architecture, the difference between the two functions disappeared. I decided to remove one of these functions to avoid confusion in the future. It shouldn't affect behavior in any way.

Kicu commented 1 week ago

@ahmedGaber93

Bug: workspace-switcher not highlight the active workspace after open search page from deeplink

I have pushed a commit that should fix this bug, please verify.

ahmedGaber93 commented 1 week ago

@Kicu still not fixed with me.

  1. set workspace-switcher to Expensify choice.
  2. open deeplink for search screen with workspace param npx uri-scheme open 'new-expensify://search/all?policyIDs=YOUR_WORKSPACE_ID' --android.
  3. click on workspace-switcher icon.

Workspace-switcher not highlight the active workspace, and instead it highlights the Expensify choice.

https://github.com/Expensify/App/assets/41129870/45b3af93-21de-4a21-9a4c-ed4f0879644b

adamgrzybowski commented 1 week ago

@ahmedGaber93 Should work now! We missed one place in linkTo

ahmedGaber93 commented 1 week ago

@adamgrzybowski Thanks for your patience. It works fine now 👍, but I faced a new issue when click the hardware back on android, it displays not found screen.

https://github.com/Expensify/App/assets/41129870/a6ccba27-7560-4cc3-ba49-42b85f985789

adamgrzybowski commented 1 week ago

@ahmedGaber93 Thanks for finding all these stuff that we missed!

I am investigating the problem you reported 🕵️‍♂️ I think I should have a fix today.

adamgrzybowski commented 1 week ago

@ahmedGaber93 I think I found the root cause, but I need to confirm with my team why we made some changes. Let me come back to this on Monday

adamgrzybowski commented 5 days ago

@ahmedGaber93 should work now 🤞

OSBotify commented 5 days ago

:hand: This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

OSBotify commented 3 days ago

🚀 Deployed to staging by https://github.com/luacmartins in version: 1.4.77-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅
OSBotify commented 2 days ago

🚀 Deployed to production by https://github.com/puneetlath in version: 1.4.77-11 🚀

platform result
🤖 android 🤖 failure ❌
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅
OSBotify commented 2 days ago

🚀 Deployed to production by https://github.com/puneetlath in version: 1.4.77-11 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅