homeflowjs 1.0.44 → 1.0.46

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.
@@ -24,6 +24,7 @@ export const setPropertyLinks = (payload) => ({
24
24
  // TODO: This method is long and repetitive. Refactor.
25
25
  export const setPropertyLinksAsync = (page = null) => (dispatch) => {
26
26
  const searchHistory = localStorage.getItem('searchHistory');
27
+
27
28
  if (!searchHistory) return null;
28
29
 
29
30
  const parsedSearchHistory = JSON.parse(searchHistory);
@@ -47,6 +48,10 @@ export const setPropertyLinksAsync = (page = null) => (dispatch) => {
47
48
  .then(({ properties, pagination }) => {
48
49
  if (!properties) return;
49
50
 
51
+ /**
52
+ * TO DO
53
+ * If current property not on list, we could still show some other properties
54
+ */
50
55
  const index = properties.findIndex((prop) => prop.property_id === Homeflow.get('property').property_id);
51
56
  if (index === -1) return;
52
57
 
@@ -106,7 +106,6 @@ const hfInitialize = () => {
106
106
  // if we're on the property show page: 1. set next and previous links, 2. post property view
107
107
  if (pageRoute === 'properties#show') {
108
108
  const propertyId = Homeflow.get('property')?.property_id;
109
- store.dispatch(setPropertyLinksAsync());
110
109
  store.dispatch(postPropertyView(propertyId));
111
110
  }
112
111
 
@@ -206,6 +205,11 @@ const hfInitialize = () => {
206
205
  store.dispatch(setSearchField({ expandedPolygon }));
207
206
  store.dispatch(setInitialSearch({ expandedPolygon }));
208
207
  }
208
+
209
+ // Perform the set of the links after searchHistory updates
210
+ if (pageRoute === 'properties#show') {
211
+ store.dispatch(setPropertyLinksAsync());
212
+ }
209
213
  }
210
214
 
211
215
  return null;
@@ -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));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homeflowjs",
3
- "version": "1.0.44",
3
+ "version": "1.0.46",
4
4
  "sideEffects": [
5
5
  "modal/**/*",
6
6
  "user/default-profile/**/*",