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