-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Add loading UI for search page menu + default to approve section for admins #72034
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
c577abf
Add loading UI for search page menu + default to approve section for …
ShridharGoel 3ecf2d6
Update tests
ShridharGoel b40a298
Show loading UI when no policies have loaded
ShridharGoel b22b467
Prettier fixes
ShridharGoel c06e3d8
Update useSearchTypeMenuSectionsTest
ShridharGoel 71fc278
Handle user offline scenario
ShridharGoel b61e5dd
Add prevIsOffline to deps
ShridharGoel 065d45a
Handle issue of extra API calls
ShridharGoel 6c13582
Update
ShridharGoel ce14210
Update
ShridharGoel 1a6e939
Merge main
ShridharGoel f2de564
Merge main
ShridharGoel fc1fb2b
Update horizontal margin for the loading UI
ShridharGoel 1953022
Merge branch 'main' of https://github.com/Expensify/App into approveS…
ShridharGoel fd4ce28
Improve design
ShridharGoel d907a63
Improve design
ShridharGoel 9460f85
Lint fixes
ShridharGoel b1ee4a3
Update to remove fade-in animation logic
ShridharGoel 18513b5
Merge branch 'main' into approveSubmit
ShridharGoel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import {useEffect, useRef} from 'react'; | ||
| import {clearAllFilters} from '@libs/actions/Search'; | ||
| import Navigation from '@libs/Navigation/Navigation'; | ||
| import type {SearchTypeMenuItem} from '@libs/SearchUIUtils'; | ||
| import CONST from '@src/CONST'; | ||
| import ROUTES from '@src/ROUTES'; | ||
|
|
||
| type UseSuggestedSearchDefaultNavigationParams = { | ||
| shouldShowSkeleton: boolean; | ||
| flattenedMenuItems: SearchTypeMenuItem[]; | ||
| similarSearchHash?: number; | ||
| clearSelectedTransactions: () => void; | ||
| }; | ||
|
|
||
| function useSuggestedSearchDefaultNavigation({shouldShowSkeleton, flattenedMenuItems, similarSearchHash, clearSelectedTransactions}: UseSuggestedSearchDefaultNavigationParams) { | ||
| const hasShownSkeleton = useRef(false); | ||
|
|
||
| useEffect(() => { | ||
| if (shouldShowSkeleton) { | ||
| hasShownSkeleton.current = true; | ||
| return; | ||
| } | ||
|
|
||
| if (!hasShownSkeleton.current) { | ||
| return; | ||
| } | ||
|
|
||
| hasShownSkeleton.current = false; | ||
|
|
||
| const defaultMenuItem = | ||
| flattenedMenuItems.find((item) => item.key === CONST.SEARCH.SEARCH_KEYS.APPROVE) ?? flattenedMenuItems.find((item) => item.key === CONST.SEARCH.SEARCH_KEYS.SUBMIT); | ||
|
|
||
| if (!defaultMenuItem || similarSearchHash === defaultMenuItem.similarSearchHash) { | ||
| return; | ||
| } | ||
|
|
||
| clearAllFilters(); | ||
| clearSelectedTransactions(); | ||
| Navigation.navigate(ROUTES.SEARCH_ROOT.getRoute({query: defaultMenuItem.searchQuery})); | ||
| }, [shouldShowSkeleton, flattenedMenuItems, similarSearchHash, clearSelectedTransactions]); | ||
| } | ||
|
|
||
| export default useSuggestedSearchDefaultNavigation; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR introduced a bug where the app overrides user-selected search tabs (e.g., Expenses) by auto-navigating to a default tab (e.g., Approve) after skeleton loading. This happens because the condition doesn’t fully account for intentional user navigation. More details and fix proposal.