mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-31 02:26:50 +10:00
Merge pull request #710 from sharetribe/query-param-cleanup
Remove unnecessary listing query params
This commit is contained in:
commit
408f8a0b1e
2 changed files with 8 additions and 22 deletions
|
|
@ -75,10 +75,8 @@ const validURLParamForExtendedData = (paramKey, urlParams) => {
|
|||
const pickSearchParamsOnly = params => {
|
||||
const { address, origin, bounds, country, ...rest } = params || {};
|
||||
return {
|
||||
address,
|
||||
origin,
|
||||
bounds,
|
||||
country,
|
||||
...validURLParamForExtendedData(CATEGORY_URL_PARAM, rest),
|
||||
...validURLParamForExtendedData(AMENITIES_URL_PARAM, rest),
|
||||
};
|
||||
|
|
@ -174,9 +172,11 @@ export class SearchPageComponent extends Component {
|
|||
latlng: ['origin'],
|
||||
latlngBounds: ['bounds'],
|
||||
});
|
||||
|
||||
const perPage = SHARETRIBE_API_MAX_PAGE_SIZE;
|
||||
const page = 1;
|
||||
const searchParamsForMapResults = { ...searchInURL, include: ['images'], page, perPage };
|
||||
const { address, country, ...rest } = searchInURL;
|
||||
const searchParamsForMapResults = { ...rest, include: ['images'], page, perPage };
|
||||
this.searchMapListingsInProgress = true;
|
||||
|
||||
// Search more listings for map
|
||||
|
|
@ -333,7 +333,7 @@ export class SearchPageComponent extends Component {
|
|||
<div className={css.searchResultContainer}>
|
||||
<SearchFilters
|
||||
className={css.searchFilters}
|
||||
urlQueryParams={urlQueryParams}
|
||||
urlQueryParams={searchInURL}
|
||||
listingsAreLoaded={listingsAreLoaded}
|
||||
resultsCount={totalItems}
|
||||
searchInProgress={searchInProgress}
|
||||
|
|
@ -345,7 +345,7 @@ export class SearchPageComponent extends Component {
|
|||
/>
|
||||
<SearchFiltersMobile
|
||||
className={css.searchFiltersMobile}
|
||||
urlQueryParams={urlQueryParams}
|
||||
urlQueryParams={searchInURL}
|
||||
listingsAreLoaded={listingsAreLoaded}
|
||||
resultsCount={totalItems}
|
||||
searchInProgress={searchInProgress}
|
||||
|
|
@ -476,7 +476,7 @@ SearchPage.loadData = (params, search) => {
|
|||
latlng: ['origin'],
|
||||
latlngBounds: ['bounds'],
|
||||
});
|
||||
const { page = 1, ...rest } = queryParams;
|
||||
const { page = 1, address, country, ...rest } = queryParams;
|
||||
return searchListings({
|
||||
...rest,
|
||||
page,
|
||||
|
|
|
|||
|
|
@ -51,14 +51,7 @@ exports[`SearchPageComponent matches snapshot 1`] = `
|
|||
resultsCount={22}
|
||||
searchInProgress={false}
|
||||
searchListingsError={null}
|
||||
urlQueryParams={
|
||||
Object {
|
||||
"address": undefined,
|
||||
"bounds": undefined,
|
||||
"country": undefined,
|
||||
"origin": undefined,
|
||||
}
|
||||
}
|
||||
urlQueryParams={Object {}}
|
||||
/>
|
||||
<InjectIntl(withRouter(SearchFiltersMobileComponent))
|
||||
amenities={
|
||||
|
|
@ -94,14 +87,7 @@ exports[`SearchPageComponent matches snapshot 1`] = `
|
|||
searchInProgress={false}
|
||||
searchListingsError={null}
|
||||
showAsModalMaxWidth={768}
|
||||
urlQueryParams={
|
||||
Object {
|
||||
"address": undefined,
|
||||
"bounds": undefined,
|
||||
"country": undefined,
|
||||
"origin": undefined,
|
||||
}
|
||||
}
|
||||
urlQueryParams={Object {}}
|
||||
/>
|
||||
<div
|
||||
className=""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue