Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix searchMode in new URL after map is moved #1443

Merged
merged 3 commits into from
May 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ way to update this template, but currently, we follow a pattern:

## Upcoming version 2020-XX-XX

- [fix] searchMode (has_all/has_any) disappeared, when search-by-moving-the-map was used.
[#1443](https://github.com/sharetribe/ftw-daily/pull/1443)

## [v8.1.1] 2021-04-20

- [change] Update jose to v3.11.4 [#1433](https://github.com/sharetribe/ftw-daily/pull/1433)
Expand Down
5 changes: 4 additions & 1 deletion src/containers/SearchPage/SearchPage.helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ export const validURLParamForExtendedData = (queryParamName, paramValueRaw, filt
if (['SelectSingleFilter', 'SelectMultipleFilter'].includes(filterConfig.type)) {
// Pick valid select options only
const allowedValues = filterConfig.config.options.map(o => o.key);
const searchMode = filterConfig.config.searchMode;
const valueArray = parseSelectFilterOptions(paramValue);
const validValues = intersection(valueArray, allowedValues).join(',');

return validValues.length > 0 ? { [queryParamName]: validValues } : {};
return validValues.length > 0
? { [queryParamName]: searchMode ? `${searchMode}:${validValues}` : validValues }
: {};
} else if (filterConfig.type === 'PriceFilter') {
// Restrict price range to correct min & max
const valueArray = paramValue ? paramValue.split(',') : [];
Expand Down