homeflowjs 1.0.45 → 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
|
|
package/app/hf-initialize.jsx
CHANGED
@@ -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;
|