homeflowjs 1.0.43 → 1.0.45

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.
@@ -51,8 +51,8 @@ export const addSearchToLocalStorage = (search) => {
51
51
  * just update the the last search in local storage to have the search's page number if
52
52
  * it has one.
53
53
  */
54
- if ((JSON.stringify(searchWithoutPageNumber) === JSON.stringify(lastSearchWithoutPageNumber)) && theSearch?.page) {
55
- const lastSearchWithUpdatedPageNumber = { ...searchHistory[0], page: theSearch.page };
54
+ if (JSON.stringify(searchWithoutPageNumber) === JSON.stringify(lastSearchWithoutPageNumber)) {
55
+ const lastSearchWithUpdatedPageNumber = { ...searchHistory[0], page: theSearch?.page || 1 };
56
56
  searchHistory.shift();
57
57
  searchHistory.unshift(lastSearchWithUpdatedPageNumber);
58
58
  localStorage.setItem('searchHistory', JSON.stringify(searchHistory));
@@ -91,7 +91,7 @@ export const updateLastSearchOnPropertyCardClick = (propertyID, remove = false)
91
91
 
92
92
  const newSearchHistory = searchHistory.map((search, index) => {
93
93
  if (index === 0) {
94
- if (remove && search?.clickedProperty && propertyID === search?.clickedProperty) {
94
+ if (remove && search?.clickedProperty && +propertyID === +search?.clickedProperty) {
95
95
  const { clickedProperty, ...rest } = search;
96
96
  /**
97
97
  * Remove clickedProperty from last search on back to search
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homeflowjs",
3
- "version": "1.0.43",
3
+ "version": "1.0.45",
4
4
  "sideEffects": [
5
5
  "modal/**/*",
6
6
  "user/default-profile/**/*",
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useRef, useMemo } from 'react';
1
+ import React, { useEffect, useRef, useMemo, Children } from 'react';
2
2
  import { connect, useSelector } from 'react-redux';
3
3
  import PropTypes from 'prop-types';
4
4
  import { propertiesByPage, updatePageInURL } from '../property-utils/property-utils';
@@ -93,7 +93,13 @@ const PropertiesDisplay = ({
93
93
  }
94
94
  return {};
95
95
  }, [properties]);
96
-
96
+
97
+ const handleListElementClick = (id = null) => {
98
+ if (id) visitPropertyUpdate(id);
99
+
100
+ return true;
101
+ }
102
+
97
103
  const items = propertiesByPage(properties, propertiesPagination).map((page, i) => (
98
104
  <ConditionalWrapper
99
105
  key={i}
@@ -101,9 +107,16 @@ const PropertiesDisplay = ({
101
107
  wrapper={(children) => (
102
108
  <div
103
109
  data-result-page={page[0].resultPage}
110
+ data-page-marker={page[0].resultPage}
104
111
  className={`results-page results-page--${displayType}`}
105
112
  >
106
- {children}
113
+ {Children.map(children, child =>
114
+ <div
115
+ onClick={() => handleListElementClick(child?.key)}
116
+ >
117
+ {child}
118
+ </div>
119
+ )}
107
120
  </div>
108
121
  )}
109
122
  >