Don't categorize when searching in report fields selection page#37583
Conversation
|
@hungvu193 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] |
Reviewer Checklist
Screenshots/VideosAndroid: Nativeandroid.movAndroid: mWeb Chromeandroid.mWeb.chrome.moviOS: Nativeios.moviOS: mWeb SafarimwebSafari.movMacOS: Chrome / Safarichrome.movMacOS: Desktopdesktop.mov |
hungvu193
left a comment
There was a problem hiding this comment.
Changes look good and test well!
| shouldShow: restOfOptions.length > 0, | ||
| data: restOfOptions.map((option) => ({ |
There was a problem hiding this comment.
@bernhardoj I think we should filter the selected option like we did with category.
App/src/libs/OptionsListUtils.ts
Line 1045 in 8f58c57
There was a problem hiding this comment.
So the All section will include all the options except the selected option, that's the expected right? @MonilBhavsar
|
@bernhardoj I'm facing this crash while trying to create new expense, can you check it? Screen.Recording.2024-03-04.at.16.38.38.movSteps to reproduce:
|
|
Can't reproduce it. Can you share the console error in text? I can only see invalid prop console error in your video. |
|
Also, this code is wrong, no? App/src/pages/EditReportFieldPage.tsx Line 46 in 35356da Looks like fieldIDs are stored as const reportField = report?.reportFields?.['expensify_' + route.params.fieldID] ?? policyReportFields?.['expensify_' + route.params.fieldID]; |
|
I can't reproduce the crash but If I create a fresh collect workspace, and request the expense, when I click the report field without anything selected it will show "Hidden", is this expected? Screen.Recording.2024-03-04.at.16.56.42.movAlso if I delete the selected option and select another options, "Recent" and "All" will also show even they're empty. Screen.Recording.2024-03-04.at.17.01.17.mov |
Yeah, looks like there are some recent BE changes. I see not found page when accessing it. @hungvu193 fixed both issues. The selected value is empty, so hidden is shown The second issue, is the condition to show the recent section title doesn't exclude the selected value yet. |
I can confirm these issues are fixed 👍 |
|
@MonilBhavsar Do you have any reliable repro steps? I can't reproduce it
|
|
No specific rules, but is not related to this PR |
| const filteredRecentlyUsedOptions = recentlyUsedOptions.filter((option) => option !== selectedValue); | ||
| const filteredFieldOptions = fieldOptions.filter((option) => option !== selectedValue); |
There was a problem hiding this comment.
Let's declared them below when they're used?
| { | ||
| const selectedValue = fieldValue; | ||
|
|
||
| setHeaderMessage(!fieldOptions.length && !recentlyUsedOptions.length ? translate('common.noResultsFound') : ''); |
There was a problem hiding this comment.
Why we need this block and that too outside of if (searchValue) {} block
There was a problem hiding this comment.
To show the no result found text. I'm not sure if I answer your question 😆
There was a problem hiding this comment.
Isn't that case handled when search value is present and on L51 above?
There was a problem hiding this comment.
@MonilBhavsar Can you confirm the expected behavior when the report field is empty? We should still show the report field, allow user to click on it and it will show no result found (like current code) or we should remove or disable report field when it's empty?
There was a problem hiding this comment.
Yes, sorry if it was unclear. Let's not include those changes in this PR.
There was a problem hiding this comment.
So let remove the line 67 and other changes will be in the next PR right?
There was a problem hiding this comment.
Yes, we can remove that line 67 👍
|
As a note, we're currently making some changes to what the reportFields return in the BE. The FE changes are being updated in #36170 |
Thanks! Those changes looks unrelated to this PR, so we should still continue with this PR |
|
The not found issue is fixed, but I found another issue after we remove the line 67. Screen.Recording.2024-03-21.at.15.30.02.movDo we want to readd it back but we willl just set it to empty string, or we can do it like this: |
I see. I prefer the second option (just make sure you use const {headerMessage, sections} = useMemo(() => {}, []) |
|
Updated based on your suggestion |
hungvu193
left a comment
There was a problem hiding this comment.
@bernhardoj Just one small change. Also please remove the HOLD from PR's title.
|
|
||
| const {sections, headerMessage} = useMemo(() => { | ||
| let newHeaderMessage = ''; | ||
| const newSections = []; |
There was a problem hiding this comment.
Can you add the type definition of newSections here?
|
Done. |
|
@hungvu193 @bernhardoj Just making sure this checklist item was followed as all screenshots are old
|
My bad 🤦 , I forgot we changed expected behavior after few discussions. I'm updating them now. |
|
Updated |
|
Thanks! Performance tests are failing. You might want to merge main? |
All check passed! All yours @MonilBhavsar |
|
@MonilBhavsar looks like this was merged without a test passing. Please add a note explaining why this was done and remove the |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/MonilBhavsar in version: 1.4.56-0 🚀
|
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 1.4.56-8 🚀
|









Details
We don't want to categorize the search result when searching in report fields selection page to make it consistent with other pages.
Fixed Issues
$ #36683
PROPOSAL: #36683 (comment)
Tests
Same as QA Steps
Offline tests
Same as QA Steps
QA Steps
Precondition:
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel so the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Screen.Recording.2024-03-21.at.23.17.11.mov
Android: mWeb Chrome
Screen.Recording.2024-03-21.at.23.20.18.mov
iOS: Native
Screen.Recording.2024-03-21.at.23.17.55.mov
iOS: mWeb Safari
Screen.Recording.2024-03-21.at.23.15.10.mov
MacOS: Chrome / Safari
Screen.Recording.2024-03-21.at.23.12.39.mov
MacOS: Desktop
Screen.Recording.2024-03-21.at.23.13.48.mov