tek-wallet 0.0.566 → 0.0.567
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.
|
@@ -204,10 +204,10 @@ function ActivitiesProvider(_a) {
|
|
|
204
204
|
});
|
|
205
205
|
}); }, [isAuthenticated]);
|
|
206
206
|
var loadActivities = (0, react_1.useCallback)(function (slug) { return __awaiter(_this, void 0, void 0, function () {
|
|
207
|
-
var page, response, activitiesLoaded, newActivities, newPage;
|
|
208
|
-
var _a, _b, _c, _d;
|
|
209
|
-
return __generator(this, function (
|
|
210
|
-
switch (
|
|
207
|
+
var page, response, activitiesLoaded, exceptedActivities, newActivities, newPage;
|
|
208
|
+
var _a, _b, _c, _d, _e;
|
|
209
|
+
return __generator(this, function (_f) {
|
|
210
|
+
switch (_f.label) {
|
|
211
211
|
case 0:
|
|
212
212
|
if (!isAuthenticated)
|
|
213
213
|
return [2 /*return*/];
|
|
@@ -228,15 +228,18 @@ function ActivitiesProvider(_a) {
|
|
|
228
228
|
transaction_types: slug,
|
|
229
229
|
})];
|
|
230
230
|
case 1:
|
|
231
|
-
response =
|
|
231
|
+
response = _f.sent();
|
|
232
232
|
activitiesLoaded = (_c = (_b = response === null || response === void 0 ? void 0 : response.data) === null || _b === void 0 ? void 0 : _b.transactions) !== null && _c !== void 0 ? _c : [];
|
|
233
|
-
|
|
233
|
+
exceptedActivities = (_e = (_d = activities === null || activities === void 0 ? void 0 : activities[slug]) === null || _d === void 0 ? void 0 : _d.filter(function (activity) {
|
|
234
|
+
return !activitiesLoaded.some(function (loadedActivity) { return loadedActivity.id === activity.id; });
|
|
235
|
+
})) !== null && _e !== void 0 ? _e : [];
|
|
236
|
+
newActivities = __spreadArray(__spreadArray([], (exceptedActivities !== null && exceptedActivities !== void 0 ? exceptedActivities : []), true), exceptedActivities, true);
|
|
234
237
|
newPage = Math.floor(newActivities.length / const_1.ACTIVITIES_PAGE_SIZE);
|
|
235
238
|
setActivities(function (prev) {
|
|
236
239
|
var _a;
|
|
237
240
|
return (__assign(__assign({}, prev), (_a = {}, _a[slug] = newActivities, _a)));
|
|
238
241
|
});
|
|
239
|
-
if (
|
|
242
|
+
if (exceptedActivities.length < const_1.ACTIVITIES_PAGE_SIZE) {
|
|
240
243
|
setPages(function (prev) {
|
|
241
244
|
var _a;
|
|
242
245
|
return (__assign(__assign({}, prev), (_a = {}, _a[slug] = type_1.MAX_PAGE, _a)));
|
|
@@ -250,7 +253,7 @@ function ActivitiesProvider(_a) {
|
|
|
250
253
|
return [2 /*return*/];
|
|
251
254
|
}
|
|
252
255
|
});
|
|
253
|
-
}); }, [isAuthenticated, activities, pages]);
|
|
256
|
+
}); }, [isAuthenticated, activities, pages, isLoadingActivities]);
|
|
254
257
|
(0, react_1.useEffect)(function () {
|
|
255
258
|
if (!isAuthenticated)
|
|
256
259
|
return;
|