homeflowjs 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -47,6 +47,11 @@ export const removeTag = (payload) => ({
47
47
  payload,
48
48
  });
49
49
 
50
+ export const removeAllTags = (payload) => ({
51
+ type: SearchActionTypes.REMOVE_ALL_TAGS,
52
+ payload,
53
+ });
54
+
50
55
  export const setPlace = (payload) => ({
51
56
  type: SearchActionTypes.SET_PLACE,
52
57
  payload,
@@ -6,6 +6,7 @@ const SearchActionTypes = {
6
6
  SET_SEARCH_FIELD: 'SET_SEARCH_FIELD',
7
7
  ADD_TAG: 'ADD_TAG',
8
8
  REMOVE_TAG: 'REMOVE_TAG',
9
+ REMOVE_ALL_TAGS: 'REMOVE_ALL_TAGS',
9
10
  TOGGLE_TAG: 'TOGGLE_TAG',
10
11
  SET_PLACE: 'SET_PLACE',
11
12
  ADD_SAVED_SEARCH: 'ADD_SAVED_SEARCH',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homeflowjs",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "sideEffects": [
5
5
  "modal/**/*",
6
6
  "user/default-profile/**/*",
@@ -89,6 +89,15 @@ const searchReducer = (state = INITIAL_STATE, action) => {
89
89
  },
90
90
  };
91
91
  }
92
+ case SearchActionTypes.REMOVE_ALL_TAGS: {
93
+ return {
94
+ ...state,
95
+ currentSearch: {
96
+ ...state.currentSearch,
97
+ tags: [],
98
+ },
99
+ };
100
+ }
92
101
  case SearchActionTypes.TOGGLE_TAG:
93
102
  const tag = action.payload;
94
103
  const newTags = state.currentSearch.tags ? [...state.currentSearch.tags] : [];
@@ -34,8 +34,22 @@ class SearchForm extends Component {
34
34
  }
35
35
 
36
36
  if (defaultChannel) setSearchField({ channel: defaultChannel });
37
- if (customsalesredirect) setSearchField({ customSalesRedirect: customsalesredirect });
38
- if (customlettingsredirect) setSearchField({ customLettingsRedirect: customlettingsredirect });
37
+ /**
38
+ * If a custom redirect has been set we need to make sure a channel
39
+ * is set in initial search search state. This is because the load more
40
+ * button loads more property results based on the initial search not
41
+ * the current search. If no channel is set it will try to load more
42
+ * properties based off the custom redirect but with no channel
43
+ * leading to no properties being found.
44
+ */
45
+ if (customsalesredirect) {
46
+ setSearchField({ customSalesRedirect: customsalesredirect })
47
+ setInitialSearch({ ...search, channel: defaultChannel ? defaultChannel : 'sales' });
48
+ }
49
+ if (customlettingsredirect) {
50
+ setSearchField({ customLettingsRedirect: customlettingsredirect })
51
+ setInitialSearch({ ...search, channel: defaultChannel ? defaultChannel : 'lettings' });
52
+ }
39
53
  }
40
54
 
41
55
  handleSubmit(e) {