Conversation
PM-4992 Update talent search view
| 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]) | ||
| }, []) |
There was a problem hiding this comment.
🔴 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":
hasSearchedremainstrue→shouldShowIntroState(TalentSearchPage.tsx:75) staysfalse→ results panel is shown instead of intro stateresultsstill contains old search data → stale results are displayed- 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.
| 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('') | |
| }, []) |
Was this helpful? React with 👍 or 👎 to provide feedback.
| page: currentPage + 1, | ||
| }) |
There was a problem hiding this comment.
🟡 "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.
Was this helpful? React with 👍 or 👎 to provide feedback.
Related JIRA Ticket:
https://topcoder.atlassian.net/browse/PM-4992
What's in this PR?