homeflowjs 0.14.3 → 1.0.1

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.
@@ -147,8 +147,9 @@ export const loadNext = () => (dispatch, getState) => {
147
147
  dispatch(setLoading({ properties: true }));
148
148
  // set page on search to page + 1
149
149
  let newProperties = [...getState().properties.properties];
150
- const nextPageSearch = { ...getState().search.currentSearch };
151
- nextPageSearch.page = nextPageSearch.page ? nextPageSearch.page + 1 : 2;
150
+ const nextPageSearch = { ...getState().search.initialSearch };
151
+ const currentPageNumber = getState()?.properties?.pagination?.current_page;
152
+ nextPageSearch.page = currentPageNumber ? currentPageNumber + 1 : 2;
152
153
  // conduct search ljson
153
154
  return fetch(`/search.ljson?${buildQueryString(nextPageSearch)}`)
154
155
  .then((response) => response.json())
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homeflowjs",
3
- "version": "0.14.3",
3
+ "version": "1.0.1",
4
4
  "sideEffects": [
5
5
  "modal/**/*",
6
6
  "user/default-profile/**/*",
@@ -19,6 +19,7 @@ const NormalSelect = ({
19
19
  maxBeds,
20
20
  placeholder,
21
21
  bedOptionText,
22
+ abbreviatedPlaceholder,
22
23
  ...otherProps
23
24
  }) => {
24
25
  const isNumberArray = (array) => array.every((item) => typeof item === 'number');
@@ -37,7 +38,7 @@ const NormalSelect = ({
37
38
  title={`${type} beds`}
38
39
  className={optionClass}
39
40
  >
40
- {placeholder || `${capitalizeFirstLetter(type)}. bedrooms`}
41
+ {placeholder || `${capitalizeFirstLetter(type)}. bed${abbreviatedPlaceholder ? '' : 'room'}s`}
41
42
  </option>
42
43
  {bedValues.map((item) => (
43
44
  isNumberArray(bedValues) ? (
@@ -75,6 +76,7 @@ const ReactSelect = (props) => {
75
76
  value,
76
77
  placeholder,
77
78
  bedOptionText,
79
+ abbreviatedPlaceholder,
78
80
  } = props;
79
81
 
80
82
  const bedOptions = bedValues.map((bedValue) => ({
@@ -90,7 +92,7 @@ const ReactSelect = (props) => {
90
92
  className={className}
91
93
  options={bedOptions}
92
94
  styles={styles}
93
- placeholder={placeholder || `${capitalizeFirstLetter(type)} bedrooms`}
95
+ placeholder={placeholder || `${capitalizeFirstLetter(type)} bed${abbreviatedPlaceholder ? '' : 'room'}s`}
94
96
  value={bedOptions.find((option) => option.value === value)}
95
97
  setValue={() => value}
96
98
  isSearchable={false}
@@ -143,6 +145,7 @@ BedroomsSelect.propTypes = {
143
145
  placeholder: PropTypes.string,
144
146
  allowUnderOver: PropTypes.bool,
145
147
  bedOptionText: PropTypes.string,
148
+ abbreviatedPlaceholder: PropTypes.bool,
146
149
  };
147
150
 
148
151
  BedroomsSelect.defaultProps = {
@@ -151,6 +154,7 @@ BedroomsSelect.defaultProps = {
151
154
  placeholder: null,
152
155
  allowUnderOver: false,
153
156
  bedOptionText: 'Bed',
157
+ abbreviatedPlaceholder: false,
154
158
  };
155
159
 
156
160
  const mapStateToProps = ({ search: { currentSearch } }) => ({
@@ -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) {