[Search v2.3] [App] Implement Saved Search feature#48566
Conversation
|
🚀 Deployed to staging by https://github.com/luacmartins in version: 9.0.35-0 🚀
|
| > | ||
| <FocusTrapForModal active={isVisible}> | ||
| <View style={isSmallScreenWidth ? {} : styles.createMenuContainer}> | ||
| <ScrollView style={isSmallScreenWidth ? {} : styles.createMenuContainer}> |
There was a problem hiding this comment.
We are looking to do something similar here but we want the scrollview to exclude the title (title should be fixed). We will move this ScrollView to wrap only currentMenuItems. Let us know if you see a reason not to do so.
|
🚀 Deployed to production by https://github.com/grgia in version: 9.0.35-7 🚀
|
| SearchActions.saveSearch({ | ||
| queryJSON, | ||
| }); | ||
|
|
There was a problem hiding this comment.
We've ended up adding additional logic – to show the educational tooltip only if we're saving the first search: #49473
| const baseMenuItem: SavedSearchMenuItem = { | ||
| key, | ||
| title: item.name, | ||
| hash: key, | ||
| query: item.query, | ||
| shouldShowRightComponent: true, | ||
| focused: Number(key) === hash, | ||
| onPress: () => { | ||
| SearchActions.clearAllFilters(); | ||
| Navigation.navigate(ROUTES.SEARCH_CENTRAL_PANE.getRoute({query: item?.query ?? ''})); | ||
| }, | ||
| rightComponent: ( | ||
| <ThreeDotsMenu | ||
| menuItems={getOverflowMenu(item.name, Number(key), item.query)} | ||
| anchorPosition={{horizontal: 0, vertical: 380}} | ||
| anchorAlignment={{ | ||
| horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.RIGHT, | ||
| vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.TOP, | ||
| }} | ||
| /> | ||
| ), | ||
| styles: [styles.alignItemsCenter], | ||
| }; |
| ); | ||
| })} | ||
| </View> | ||
| {savedSearches && Object.keys(savedSearches).length > 0 && ( |
There was a problem hiding this comment.
We need to filter out the pending action here, link to the issue: #51028
| SearchActions.deleteSavedSearch(hashToDelete); | ||
| setIsDeleteModalVisible(false); | ||
| SearchActions.clearAdvancedFilters(); | ||
| Navigation.navigate( |
There was a problem hiding this comment.
We need to trigger dismissModal before navigating to SEARCH_CENTRAL_PANE, coming from #49943
|
|
||
| SearchActions.saveSearch({ | ||
| queryJSON, | ||
| name: newName, |
There was a problem hiding this comment.
✋ Coming from #50225
The newName state can be filled with an empty string and the BE will fall back to the query. So we doing something but in the FE newName?.trim() || q, this will make the saveSearch offline work.
| </View> | ||
| {savedSearches && Object.keys(savedSearches).length > 0 && ( | ||
| <> | ||
| <ScrollView>{renderSavedSearchesSection(savedSearchesMenuItems())}</ScrollView> |
There was a problem hiding this comment.
We only wrapped the saved search list with a scroll view, so it's only the saved search that was scrollable, But the design team expected that the whole menu to be scrollable, I don't have access to design doc to determine if this was expected or a missed case. But this caused #52910
| SearchActions.clearAdvancedFilters(); | ||
| Navigation.navigate( | ||
| ROUTES.SEARCH_CENTRAL_PANE.getRoute({ | ||
| query: SearchUtils.buildCannedSearchQuery(CONST.SEARCH.DATA_TYPES.EXPENSE, CONST.SEARCH.STATUS.EXPENSE.ALL), | ||
| }), |
There was a problem hiding this comment.
Coming from #57749, we should have cleared this only if the current hash was equal to the hash to delete.
Details
Video test for desktop:
Screen.Recording.2024-09-09.at.16.01.22.mov
Translations have been asked here
Note: I've decided to fix all the frontend issues in one PR, since all of them are tightly intertwined.
Fixed Issues
$ #48453
$ #48454
$ #48458
$ #48457
$ #48455
Tests
Saving a New Search
Renaming a Saved Search
Deleting a Saved Search
Viewing and Saving Filtered Results
Creating Multiple Saved Searches
Accessing Saved Searches
Review the Search Results
Offline tests
NA
QA Steps
QA Steps
Same as in tests
PR Author Checklist
I linked the correct issue in the
### Fixed Issuessection aboveI wrote clear testing steps that cover the changes made in this PR
TestssectionOffline stepssectionQA stepssectionI included screenshots or videos for tests on all platforms
I ran the tests on all platforms & verified they passed on:
I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
I followed proper code patterns (see Reviewing the code)
toggleReportand 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 followedIf a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
I followed the guidelines as stated in the Review Guidelines
I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like
Avatar, I verified the components usingAvatarare working as expected)I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
I verified that if a function's arguments changed that all usages have also been updated correctly
If any new file was added I verified that:
If a new CSS style is added I verified that:
StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like
Avataris modified, I verified thatAvataris working as expected in all cases)If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
If the PR modifies the form input styles:
Designlabel so the design team can review the changes.If a new page is added, I verified it's using the
ScrollViewcomponent to make it scrollable when more elements are added to the page.If the
mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.I verified that similar component doesn't exist in the codebase
I verified that all props are defined accurately and each prop has a
/** comment above it */I verified that each file is named correctly
I verified that each component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
I verified that the only data being stored in component state is data necessary for rendering and nothing else
In component if we are not using the full Onyx data that we loaded, I've added the proper selector in order to ensure the component only re-renders when the data it is using changes
For Class Components, any internal methods passed to components event handlers are bound to
thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)I verified that component internal methods bound to
thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)I verified that all JSX used for rendering exists in the render method
I verified that each component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
I verified that similar component doesn't exist in the codebase
I verified that all props are defined accurately and each prop has a
/** comment above it */I verified that each file is named correctly
I verified that each component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
I verified that the only data being stored in component state is data necessary for rendering and nothing else
In component if we are not using the full Onyx data that we loaded, I've added the proper selector in order to ensure the component only re-renders when the data it is using changes
For Class Components, any internal methods passed to components event handlers are bound to
thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)I verified that component internal methods bound to
thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)I verified that all JSX used for rendering exists in the render method
I verified that each component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
Screenshots/Videos
Android: Native
Screen.Recording.2024-09-10.at.11.55.03.mov
Android: mWeb Chrome
Screen.Recording.2024-09-10.at.12.00.37.mov
iOS: Native
iOS: mWeb Safari
Screen.Recording.2024-09-10.at.10.54.54.mov
MacOS: Chrome / Safari
Screen.Recording.2024-09-09.at.16.01.22.mov
MacOS: Desktop
Screen.Recording.2024-09-10.at.11.59.15.mov