Skip to content
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

cleanup: split filtering & ordering in OptionsListUtils #53371

Merged
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e68f0a8
wip, current problem:
hannojg Nov 25, 2024
48d4fa1
split out filtering and ordering very cleanly so we can apply splicin…
hannojg Nov 26, 2024
65c770e
fix sorting not working
hannojg Nov 26, 2024
8bb573f
fix usage
hannojg Nov 26, 2024
717d750
rename getOptions -> getValidOptions
hannojg Nov 26, 2024
8ff8248
remove any todos
hannojg Nov 26, 2024
0636ee7
Merge branch 'main' of github.com:Expensify/App into cleanup/split-fi…
hannojg Dec 2, 2024
8bd35e3
add missing `userToInvite` back to filterOptions
hannojg Dec 2, 2024
2e2448c
refactor: move userToInvite to its own function
hannojg Dec 2, 2024
e46e6ec
fix getOptions -> getValidOptions
hannojg Dec 2, 2024
77e2224
clean: order functions
hannojg Dec 2, 2024
08d1187
cleanup configs
hannojg Dec 2, 2024
a75bf95
fix ordering
hannojg Dec 2, 2024
2eaeaf4
fix ordering when `maxRecentReportsToShow` option is set (added test …
hannojg Dec 4, 2024
8c98f84
remove maxRecentOptionsToShow
hannojg Dec 4, 2024
9e37f36
add test to verify behaviour of maxRecentReportsToShow: 0
hannojg Dec 4, 2024
1e7a3b4
simplify into one var
hannojg Dec 4, 2024
e26cccb
fix ordering
hannojg Dec 4, 2024
5373208
fix ordering logic
hannojg Dec 4, 2024
c60f18d
fix broken screens
hannojg Dec 4, 2024
ec8df5e
remove slightly redundant code
hannojg Dec 4, 2024
59b5f3f
Merge branch 'main' of github.com:Expensify/App into cleanup/split-fi…
hannojg Dec 6, 2024
e369474
use `filterAndOrderOptions`
hannojg Dec 6, 2024
3285c33
potentially fix search
hannojg Dec 6, 2024
dfa6fd6
maxRecentReportsToShow: 0 should return zero reports
hannojg Dec 6, 2024
b174805
Merge branch 'main' of github.com:Expensify/App into cleanup/split-fi…
hannojg Dec 9, 2024
ee50f31
fix ordering by making it two separate order function calls as before
hannojg Dec 9, 2024
25a1352
call orderOptions
hannojg Dec 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/Search/SearchFiltersChatsSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function SearchFiltersChatsSelector({initialReportIDs, onFiltersUpdate, isScreen
}, [areOptionsInitialized, isScreenTransitionEnd, options]);

const chatOptions = useMemo(() => {
return OptionsListUtils.filterOptions(defaultOptions, cleanSearchTerm, {
return OptionsListUtils.filterAndOrderOptions(defaultOptions, cleanSearchTerm, {
selectedOptions,
excludeLogins: CONST.EXPENSIFY_EMAILS,
maxRecentReportsToShow: 0,
hannojg marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
5 changes: 2 additions & 3 deletions src/components/Search/SearchFiltersParticipantsSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,20 @@ function SearchFiltersParticipantsSelector({initialAccountIDs, onFiltersUpdate}:
return defaultListOptions;
}

return OptionsListUtils.getOptions(
return OptionsListUtils.getValidOptions(
{
reports: options.reports,
personalDetails: options.personalDetails,
},
{
selectedOptions,
excludeLogins: CONST.EXPENSIFY_EMAILS,
maxRecentReportsToShow: 0,
},
);
}, [areOptionsInitialized, options.personalDetails, options.reports, selectedOptions]);

const chatOptions = useMemo(() => {
return OptionsListUtils.filterOptions(defaultOptions, cleanSearchTerm, {
return OptionsListUtils.filterAndOrderOptions(defaultOptions, cleanSearchTerm, {
selectedOptions,
excludeLogins: CONST.EXPENSIFY_EMAILS,
maxRecentReportsToShow: CONST.IOU.MAX_RECENT_REPORTS_TO_SHOW,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Search/SearchRouter/SearchRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ function SearchRouter({onRouterClose, shouldHideInputCaret}: SearchRouterProps)
}

Timing.start(CONST.TIMING.SEARCH_FILTER_OPTIONS);
const newOptions = OptionsListUtils.filterOptions(searchOptions, debouncedInputValue, {sortByReportTypeInSearch: true, preferChatroomsOverThreads: true});
const newOptions = OptionsListUtils.filterAndOrderOptions(searchOptions, debouncedInputValue, {sortByReportTypeInSearch: true, preferChatroomsOverThreads: true});
Timing.end(CONST.TIMING.SEARCH_FILTER_OPTIONS);

return {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Search/SearchRouter/SearchRouterList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ function SearchRouterList(
return [];
}

const filteredOptions = OptionsListUtils.getOptions(
const filteredOptions = OptionsListUtils.getValidOptions(
{
reports: options.reports,
personalDetails: options.personalDetails,
Expand Down
Loading
Loading