Skip to content

Commit 84c1269

Browse files
committed
Fixing reuse candidates
1 parent bdf1d13 commit 84c1269

1 file changed

Lines changed: 1 addition & 15 deletions

File tree

src/components/map-projects/MapProject.jsx

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2044,18 +2044,6 @@ const MapProject = () => {
20442044
}).then(response => callback(response, payload))
20452045
}
20462046

2047-
const normalizeCandidateRequestValue = value => {
2048-
if(isArray(value))
2049-
return orderBy(map(value, normalizeCandidateRequestValue))
2050-
if(value && typeof value === 'object')
2051-
return Object.fromEntries(orderBy(keys(value)).map(key => [key, normalizeCandidateRequestValue(value[key])]))
2052-
return value
2053-
}
2054-
2055-
const areCandidateRequestsEqual = (left, right) => JSON.stringify(normalizeCandidateRequestValue(left || {})) === JSON.stringify(normalizeCandidateRequestValue(right || {}))
2056-
2057-
const getRequestedCandidateFilter = (index, _filters) => getFacetQueryParam(isEmpty(_filters) ? appliedFacets[index] : _filters)
2058-
20592047
const fetchAllCandidatesForRow = (algoId, _row, offset=0, _retired, scrollToBottom, _filters, forceReload=false) => {
20602048
if(loadingMatches)
20612049
return
@@ -2072,12 +2060,10 @@ const MapProject = () => {
20722060
let __row = isEmpty(_row) ? row : _row
20732061

20742062
const existingCandidates = find(allCandidatesRef.current[algoId], c => c.row.__index === __row.__index)
2075-
const requestedFilter = getRequestedCandidateFilter(__row.__index, _filters)
20762063
const canReuseExistingCandidates = !forceReload &&
20772064
offset === 0 &&
20782065
!_retired &&
2079-
existingCandidates?.results?.length > 0 &&
2080-
areCandidateRequestsEqual(existingCandidates?.filter, requestedFilter)
2066+
existingCandidates?.results?.length > 0
20812067

20822068
if(canReuseExistingCandidates) {
20832069
markAlgo(__row.__index, algoId, 1)

0 commit comments

Comments
 (0)