Only show listings that are visible in the current view
This commit is contained in:
@@ -16,7 +16,7 @@ const viewListingDetails= ({type, action}, component) => {
|
||||
}
|
||||
|
||||
const listingsLoaded = ({type, action}, component) => {
|
||||
const currentListings = component.state.listings;
|
||||
const currentListings = new Map(); //component.state.listings;
|
||||
|
||||
for(const listing of action.listings) {
|
||||
currentListings.set(listing.url, listing)
|
||||
@@ -55,6 +55,12 @@ const viewImage = ({type, action}, component) => {
|
||||
});
|
||||
}
|
||||
|
||||
const searchPlaceChanged = ({type, action}, component) => {
|
||||
component.setState({
|
||||
listingDetails: false
|
||||
});
|
||||
}
|
||||
|
||||
const handlers = {
|
||||
'SET_MIN_PRICE': setMinPrice,
|
||||
'LISTINGS_LOADED': listingsLoaded,
|
||||
@@ -62,6 +68,7 @@ const handlers = {
|
||||
'PREV_IMAGE': prevImage,
|
||||
'NEXT_IMAGE': nextImage,
|
||||
'VIEW_IMAGE': viewImage,
|
||||
'SEARCH_PLACE_CHANGED': searchPlaceChanged,
|
||||
'VIEW_LISTING_DETAILS': viewListingDetails
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user