@searchspring/snap-store-mobx 0.63.2 → 0.63.4

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.
@@ -76,7 +76,9 @@ var SearchStore = /** @class */ (function (_super) {
76
76
  this.search = new Stores_1.SearchQueryStore(this.services, (data === null || data === void 0 ? void 0 : data.search) || {});
77
77
  this.facets = new Stores_1.SearchFacetStore(this.config, this.services, this.storage, data.facets, (data === null || data === void 0 ? void 0 : data.pagination) || {}, this.meta.data, (data === null || data === void 0 ? void 0 : data.merchandising) || {});
78
78
  this.filters = new Stores_1.SearchFilterStore(this.services, data.filters, this.meta.data);
79
- this.results = new Stores_1.SearchResultStore(this.config, this.services, this.meta.data, (data === null || data === void 0 ? void 0 : data.results) || [], data.pagination, data.merchandising, this.loaded, (_a = this.previousData) === null || _a === void 0 ? void 0 : _a.pagination, this.results);
79
+ this.results = new Stores_1.SearchResultStore(this.config, this.services, this.meta.data, (data === null || data === void 0 ? void 0 : data.results) || [], data.pagination, data.merchandising, this.loaded, (_a = this.previousData) === null || _a === void 0 ? void 0 : _a.pagination
80
+ // this.results // used with infinite scroll to append previous results
81
+ );
80
82
  this.pagination = new Stores_1.SearchPaginationStore(this.config, this.services, data.pagination, this.meta.data);
81
83
  this.sorting = new Stores_1.SearchSortingStore(this.services, (data === null || data === void 0 ? void 0 : data.sorting) || [], (data === null || data === void 0 ? void 0 : data.search) || {}, this.meta.data);
82
84
  this.loaded = !!data.pagination;
@@ -84,7 +84,7 @@ var SearchResultStore = /** @class */ (function (_super) {
84
84
  }
85
85
  }
86
86
  // only when infinite is enabled
87
- if ((_d = config === null || config === void 0 ? void 0 : config.settings) === null || _d === void 0 ? void 0 : _d.infinite) {
87
+ if (((_d = config === null || config === void 0 ? void 0 : config.settings) === null || _d === void 0 ? void 0 : _d.infinite) && previousResults) {
88
88
  // logic to determine when to concatenate previous results
89
89
  // this logic is not bullet proof, but it is highly unlikely that the current and previous pagination data would ever be sequential unless paginating
90
90
  // TODO: implement "load previous" with a limit to how many total products can be displayed
@@ -53,7 +53,9 @@ export class SearchStore extends AbstractStore {
53
53
  this.search = new SearchQueryStore(this.services, data?.search || {});
54
54
  this.facets = new SearchFacetStore(this.config, this.services, this.storage, data.facets, data?.pagination || {}, this.meta.data, data?.merchandising || {});
55
55
  this.filters = new SearchFilterStore(this.services, data.filters, this.meta.data);
56
- this.results = new SearchResultStore(this.config, this.services, this.meta.data, data?.results || [], data.pagination, data.merchandising, this.loaded, this.previousData?.pagination, this.results);
56
+ this.results = new SearchResultStore(this.config, this.services, this.meta.data, data?.results || [], data.pagination, data.merchandising, this.loaded, this.previousData?.pagination
57
+ // this.results // used with infinite scroll to append previous results
58
+ );
57
59
  this.pagination = new SearchPaginationStore(this.config, this.services, data.pagination, this.meta.data);
58
60
  this.sorting = new SearchSortingStore(this.services, data?.sorting || [], data?.search || {}, this.meta.data);
59
61
  this.loaded = !!data.pagination;
@@ -43,7 +43,7 @@ export class SearchResultStore extends Array {
43
43
  }
44
44
  }
45
45
  // only when infinite is enabled
46
- if (config?.settings?.infinite) {
46
+ if (config?.settings?.infinite && previousResults) {
47
47
  // logic to determine when to concatenate previous results
48
48
  // this logic is not bullet proof, but it is highly unlikely that the current and previous pagination data would ever be sequential unless paginating
49
49
  // TODO: implement "load previous" with a limit to how many total products can be displayed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@searchspring/snap-store-mobx",
3
- "version": "0.63.2",
3
+ "version": "0.63.4",
4
4
  "description": "Snap MobX Store",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -20,16 +20,16 @@
20
20
  "test:watch": "jest --watch"
21
21
  },
22
22
  "dependencies": {
23
- "@searchspring/snap-toolbox": "^0.63.2",
23
+ "@searchspring/snap-toolbox": "^0.63.4",
24
24
  "mobx": "6.9.0"
25
25
  },
26
26
  "devDependencies": {
27
- "@searchspring/snap-client": "^0.63.2",
28
- "@searchspring/snap-url-manager": "^0.63.2"
27
+ "@searchspring/snap-client": "^0.63.4",
28
+ "@searchspring/snap-url-manager": "^0.63.4"
29
29
  },
30
30
  "sideEffects": false,
31
31
  "files": [
32
32
  "dist/**/*"
33
33
  ],
34
- "gitHead": "e0cbff5ebba37135d0ead609f6dc4b4b8db48916"
34
+ "gitHead": "8d744ee5f79d14ed44a3d2f1dcf8cd2a08f12485"
35
35
  }