Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export type MemberSearchPayload = {
openToWork?: boolean
page: number
recentlyActive?: boolean
sortBy?: 'handle' | 'matchIndex'
sortOrder?: 'asc' | 'desc'
skillSearchType: 'OR'
skills: Array<{
id: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,8 @@ export const TalentSearchPage: FC = () => {
return true
}), [onlyActive, onlyOpenToWork, results])

const displayedResults = useMemo(() => {
const sorted = [...filteredResults]
if (activeSort === 'matching-index') {
sorted.sort((a, b) => b.matchIndex - a.matchIndex)
return sorted
}

sorted.sort((a, b) => String(a.handle || '')
.localeCompare(String(b.handle || ''), undefined, { sensitivity: 'base' }))
return sorted
}, [activeSort, filteredResults])
// Order comes from reports-api (sortBy/sortOrder on each request) so pagination stays globally consistent.
const displayedResults = filteredResults

const foundMembersCount = totalResults || displayedResults.length
const displayedResultsWithCountryName = useMemo(
Expand Down Expand Up @@ -175,6 +166,7 @@ export const TalentSearchPage: FC = () => {
const openToWork = overrides?.openToWork ?? onlyOpenToWork
const page = overrides?.page ?? 1
const recentlyActive = overrides?.recentlyActive ?? onlyActive
const hasSkills = skillsToSearch.length > 0
const payload: MemberSearchPayload = {
limit: MEMBER_SEARCH_LIMIT,
page,
Expand All @@ -187,6 +179,8 @@ export const TalentSearchPage: FC = () => {
wins: 1,
})),
skillSearchType: 'OR',
sortBy: hasSkills ? 'matchIndex' : 'handle',
sortOrder: hasSkills ? 'desc' : 'asc',
}

if (countries.length > 0) {
Expand Down
Loading