mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-28 20:53:24 +10:00
Clear and fix merging of paginated map listing fetches
This commit is contained in:
parent
c591a73ef5
commit
c2d0472add
1 changed files with 10 additions and 3 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import { unionWith } from 'lodash';
|
||||
import { addMarketplaceEntities } from '../../ducks/marketplaceData.duck';
|
||||
|
||||
// ================ Action types ================ //
|
||||
|
|
@ -33,6 +34,7 @@ const listingPageReducer = (state = initialState, action = {}) => {
|
|||
searchParams: payload.searchParams,
|
||||
searchInProgress: true,
|
||||
currentPageResultIds: [],
|
||||
searchMapListingIds: [],
|
||||
searchListingsError: null,
|
||||
};
|
||||
case SEARCH_LISTINGS_SUCCESS:
|
||||
|
|
@ -50,14 +52,19 @@ const listingPageReducer = (state = initialState, action = {}) => {
|
|||
case SEARCH_MAP_LISTINGS_REQUEST:
|
||||
return {
|
||||
...state,
|
||||
//searchMapListingIds: [],
|
||||
searchMapListingsError: null,
|
||||
};
|
||||
case SEARCH_MAP_LISTINGS_SUCCESS:
|
||||
case SEARCH_MAP_LISTINGS_SUCCESS: {
|
||||
const searchMapListingIds = unionWith(
|
||||
state.searchMapListingIds,
|
||||
resultIds(payload.data),
|
||||
(id1, id2) => id1.uuid === id2.uuid
|
||||
);
|
||||
return {
|
||||
...state,
|
||||
searchMapListingIds: state.searchMapListingIds.concat(resultIds(payload.data)),
|
||||
searchMapListingIds,
|
||||
};
|
||||
}
|
||||
case SEARCH_MAP_LISTINGS_ERROR:
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(payload);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue