@react-pakistan/util-functions 1.25.24 → 1.25.25

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.
@@ -166,7 +166,7 @@ exports.getCachedDataSync = getCachedDataSync;
166
166
  * const active = await getCachedData<UserBE>({ config, filters: { enabled: true }, pageLimit: 200 });
167
167
  */
168
168
  var getCachedData = function (opts) { return __awaiter(void 0, void 0, void 0, function () {
169
- var config, params, headers, cacheKey, apiUrl, responseKey, expirationMs, fallBackPageLimit, fallBackCurrentPage, filters, searchQuery, paramsWithoutFilters_1, otherParams_1, queryObj_1, searchParams_1, response_1, items_1, raw, currentTime, cachedTime, ageInMs, cachedTime, ageInMs, itemsArray, paramsWithoutFilters_2, otherParams, queryObj, searchParams, response, itemsRaw, items, count, shouldCache, itemsMap, updatedCache, error_1;
169
+ var config, params, headers, cacheKey, apiUrl, responseKey, expirationMs, fallBackPageLimit, fallBackCurrentPage, filters, searchQuery, paramsWithoutFilters_1, otherParams_1, queryObj_1, searchParams_1, response_1, items_1, lastCacheVersion, raw, currentTime, cachedTime, ageInMs, cachedTime, ageInMs, itemsArray, paramsWithoutFilters_2, otherParams, queryObj, searchParams, response, itemsRaw, items, count, shouldCache, itemsMap, updatedCache, error_1;
170
170
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
171
171
  return __generator(this, function (_m) {
172
172
  switch (_m.label) {
@@ -208,8 +208,9 @@ var getCachedData = function (opts) { return __awaiter(void 0, void 0, void 0, f
208
208
  items_1 = responseKey
209
209
  ? ((_f = response_1 === null || response_1 === void 0 ? void 0 : response_1.data) === null || _f === void 0 ? void 0 : _f[responseKey]) || []
210
210
  : ((_g = response_1 === null || response_1 === void 0 ? void 0 : response_1.data) === null || _g === void 0 ? void 0 : _g.items) || (response_1 === null || response_1 === void 0 ? void 0 : response_1.data) || [];
211
+ lastCacheVersion = (0, local_storage_1.getStorageValue)(cacheKey);
211
212
  return [2 /*return*/, {
212
- count: ((_h = response_1 === null || response_1 === void 0 ? void 0 : response_1.data) === null || _h === void 0 ? void 0 : _h.count) || items_1.length,
213
+ count: ((_h = response_1 === null || response_1 === void 0 ? void 0 : response_1.data) === null || _h === void 0 ? void 0 : _h.count) || (lastCacheVersion === null || lastCacheVersion === void 0 ? void 0 : lastCacheVersion.count),
213
214
  items: items_1,
214
215
  }];
215
216
  case 3:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-pakistan/util-functions",
3
- "version": "1.25.24",
3
+ "version": "1.25.25",
4
4
  "description": "A library of all util functions",
5
5
  "main": "index.js",
6
6
  "scripts": {