-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[Search v1] Add sorting #42248
Merged
luacmartins
merged 15 commits into
Expensify:main
from
software-mansion-labs:kicu/search-v2/sorting
May 30, 2024
Merged
[Search v1] Add sorting #42248
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
c553e4b
Refactor SearchTableHeader to allow for sorting by column
Kicu 48abb83
Implement search sorting and update page params
Kicu b18bfa1
Add small improvements to Search sorting
Kicu b489783
Fix text not aligned in TransactionListItem
Kicu 62dc109
Update search to work with pagination
Kicu 031fe03
Fix navigation types
Kicu 6e379da
Make sorting work for every Search column
Kicu 7dab172
Allow sorting by more columns
Kicu 782a42d
Refactor sorting props and update sorting hash generation
Kicu 978e56e
Merge branch 'main' into kicu/search-v2/sorting
Kicu 5a71c3f
Update styling of SearchTableHeader column
Kicu fea6522
Fix sorting by merchant column
Kicu 767373f
Merge branch 'main' into kicu/search-v2/sorting
Kicu 7660bd9
Merge branch 'main' into kicu/search-v2/sorting
Kicu 2fd1c57
Fix receipt header missing after merge conflicts
Kicu 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 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 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 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 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 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.
I wonder if we should be computing a new hash for each set of sorting param since the search results would be different than what we currently have. I think we should at least reset the offset, since the following seems to be possible:
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.
Maybe one optimization would be when
hasMoreResults = false
since we know we have all available data and wouldn't need to fetch anything else to properly sort things in the client.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.
I agree with this and I will add sortBy and sortOrder to hash generation.
However I think the scenario you described would not happen because in this specific line offset is set always to
0
inside useEffect.So in your scenario in point 3 if you sort by different column or change order, then this
useEffect
block will be in place and a fresh call will be made withoffset: 0
. If you keep scrolling then another call will be made with offset 50 or whatever, but the one with the 0 was already there.Perhaps another solution is to scroll list to top if you switch sort/order?I now believe that adding sortBy + sortOrder into
hash
solves all our problems because onyx key changes.Please verify this yourself