@searchspring/snap-store-mobx
Advanced tools
Comparing version 0.63.2 to 0.63.3
@@ -79,3 +79,5 @@ "use strict"; | ||
this.filters = new Stores_1.SearchFilterStore(this.services, data.filters, this.meta.data); | ||
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); | ||
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 // used with infinite scroll to append previous results | ||
); | ||
this.pagination = new Stores_1.SearchPaginationStore(this.config, this.services, data.pagination, this.meta.data); | ||
@@ -82,0 +84,0 @@ 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); |
@@ -87,3 +87,3 @@ "use strict"; | ||
// only when infinite is enabled | ||
if ((_d = config === null || config === void 0 ? void 0 : config.settings) === null || _d === void 0 ? void 0 : _d.infinite) { | ||
if (((_d = config === null || config === void 0 ? void 0 : config.settings) === null || _d === void 0 ? void 0 : _d.infinite) && previousResults) { | ||
// logic to determine when to concatenate previous results | ||
@@ -90,0 +90,0 @@ // this logic is not bullet proof, but it is highly unlikely that the current and previous pagination data would ever be sequential unless paginating |
@@ -56,3 +56,5 @@ import { makeObservable, observable } from 'mobx'; | ||
this.filters = new SearchFilterStore(this.services, data.filters, this.meta.data); | ||
this.results = new SearchResultStore(this.config, this.services, this.meta.data, data?.results || [], data.pagination, data.merchandising, this.loaded, this.previousData?.pagination, this.results); | ||
this.results = new SearchResultStore(this.config, this.services, this.meta.data, data?.results || [], data.pagination, data.merchandising, this.loaded, this.previousData?.pagination | ||
// this.results // used with infinite scroll to append previous results | ||
); | ||
this.pagination = new SearchPaginationStore(this.config, this.services, data.pagination, this.meta.data); | ||
@@ -59,0 +61,0 @@ this.sorting = new SearchSortingStore(this.services, data?.sorting || [], data?.search || {}, this.meta.data); |
@@ -46,3 +46,3 @@ import { computed, makeObservable, observable } from 'mobx'; | ||
// only when infinite is enabled | ||
if (config?.settings?.infinite) { | ||
if (config?.settings?.infinite && previousResults) { | ||
// logic to determine when to concatenate previous results | ||
@@ -49,0 +49,0 @@ // this logic is not bullet proof, but it is highly unlikely that the current and previous pagination data would ever be sequential unless paginating |
{ | ||
"name": "@searchspring/snap-store-mobx", | ||
"version": "0.63.2", | ||
"version": "0.63.3", | ||
"description": "Snap MobX Store", | ||
@@ -23,8 +23,8 @@ "main": "dist/cjs/index.js", | ||
"dependencies": { | ||
"@searchspring/snap-toolbox": "^0.63.2", | ||
"@searchspring/snap-toolbox": "^0.63.3", | ||
"mobx": "6.9.0" | ||
}, | ||
"devDependencies": { | ||
"@searchspring/snap-client": "^0.63.2", | ||
"@searchspring/snap-url-manager": "^0.63.2" | ||
"@searchspring/snap-client": "^0.63.3", | ||
"@searchspring/snap-url-manager": "^0.63.3" | ||
}, | ||
@@ -35,3 +35,3 @@ "sideEffects": false, | ||
], | ||
"gitHead": "e0cbff5ebba37135d0ead609f6dc4b4b8db48916" | ||
"gitHead": "cd9624efa3636a0344ba4e6b5a7d3eb6e33508fb" | ||
} |
379845
7144