Skip to content

[PROD RELEASE] Talent Search Updates#1796

Merged
vas3a merged 2 commits intomasterfrom
dev
Apr 30, 2026
Merged

[PROD RELEASE] Talent Search Updates#1796
vas3a merged 2 commits intomasterfrom
dev

Conversation

@himaniraghav3
Copy link
Copy Markdown
Collaborator

@himaniraghav3 himaniraghav3 commented Apr 30, 2026

Related JIRA Ticket:

https://topcoder.atlassian.net/browse/PM-4992

What's in this PR?


Open in Devin Review

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

View 4 additional findings in Devin Review.

Open in Devin Review

Comment on lines 245 to +253
const clearAllFilters = useCallback((): void => {
searchGenerationRef.current += 1
setSelectedCountries([])
setOnlyProfileComplete(true)
setOnlyProfileComplete(false)
setOnlyOpenToWork(true)
setOnlyActive(true)
setSortBy('alphabetical')
setSelectedSkills([])
setHasSearched(true)
setErrorMessage('')
skipNextAutoSearchRef.current = true
setLastSearchedDescription('')
runMemberSearch([], {
countries: [],
generation: searchGenerationRef.current,
openToWork: true,
page: 1,
profileComplete: true,
recentlyActive: true,
})
}, [runMemberSearch])
}, [])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 clearAllFilters doesn't reset hasSearched or clear stale results, leaving user stuck

clearAllFilters (line 245) resets filter state (selectedSkills, selectedCountries, toggles) but never resets hasSearched, results, totalResults, or lastAppliedSearchSignature. After a user performs a search and then clicks "Clear Filters":

  1. hasSearched remains trueshouldShowIntroState (TalentSearchPage.tsx:75) stays false → results panel is shown instead of intro state
  2. results still contains old search data → stale results are displayed
  3. The Search button is disabled because selectedSkills.length === 0 (TalentSearchPage.tsx:492)

The user is stuck seeing stale results with no way to return to the intro state or trigger a new search.

Suggested change
const clearAllFilters = useCallback((): void => {
searchGenerationRef.current += 1
setSelectedCountries([])
setOnlyProfileComplete(true)
setOnlyProfileComplete(false)
setOnlyOpenToWork(true)
setOnlyActive(true)
setSortBy('alphabetical')
setSelectedSkills([])
setHasSearched(true)
setErrorMessage('')
skipNextAutoSearchRef.current = true
setLastSearchedDescription('')
runMemberSearch([], {
countries: [],
generation: searchGenerationRef.current,
openToWork: true,
page: 1,
profileComplete: true,
recentlyActive: true,
})
}, [runMemberSearch])
}, [])
const clearAllFilters = useCallback((): void => {
setSelectedCountries([])
setOnlyProfileComplete(false)
setOnlyOpenToWork(true)
setOnlyActive(true)
setSelectedSkills([])
setErrorMessage('')
setLastSearchedDescription('')
setHasSearched(false)
setResults([])
setTotalResults(0)
setLastAppliedSearchSignature('')
}, [])
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines 343 to 344
page: currentPage + 1,
})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 "Load More" uses current (possibly changed) filter state instead of the filters from the original search

handleLoadMore (TalentSearchPage.tsx:341) calls runMemberSearch without passing explicit filter overrides (openToWork, profileComplete, recentlyActive, countries). These fall back to the current state values inside runMemberSearch (TalentSearchPage.tsx:156-159). In the old auto-search code, changing a toggle would immediately trigger a new search (resetting pagination), so Load More always used consistent filters. With the new manual-search model, a user can change toggles after searching without triggering a re-search, then click "Load More" — causing page 2+ results to be fetched with different filter criteria than page 1, producing inconsistent merged results.

(Refers to lines 341-344)

Prompt for agents
The handleLoadMore function at TalentSearchPage.tsx:336-345 calls runMemberSearch without explicit filter overrides. Since the refactoring moved from auto-search to manual-search, the user can now change toggle values (openToWork, onlyActive, onlyProfileComplete) or countries between the initial search and clicking Load More. This causes page 2+ to use different filter criteria than page 1.

To fix this, store the filter parameters that were used for the last successful search (e.g., in a ref or state variable alongside lastAppliedSearchSignature), and pass those stored values as overrides in handleLoadMore. This ensures pagination always uses the same criteria as the initial search.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@vas3a vas3a merged commit a468065 into master Apr 30, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants