Skip to content

Commit

Permalink
Merge pull request #2772 from myxmaster/improve_activity_performance
Browse files Browse the repository at this point in the history
Activity: improve performance
  • Loading branch information
kaloudis authored Jan 27, 2025
2 parents be83aaa + c848726 commit bb537cb
Show file tree
Hide file tree
Showing 3 changed files with 304 additions and 381 deletions.
11 changes: 1 addition & 10 deletions stores/ActivityStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export const DEFAULT_FILTERS = {
};

export default class ActivityStore {
@observable public loading = false;
@observable public error = false;
@observable public activity: Array<Invoice | Payment | Transaction> = [];
@observable public filteredActivity: Array<
Expand Down Expand Up @@ -156,7 +155,6 @@ export default class ActivityStore {

@action
public getActivity = async () => {
this.loading = true;
this.activity = [];
await this.paymentsStore.getPayments();
if (BackendUtils.supportsOnchainSends())
Expand All @@ -165,8 +163,6 @@ export default class ActivityStore {

this.activity = this.getSortedActivity();
this.filteredActivity = this.activity;

this.loading = false;
};

@action
Expand All @@ -186,7 +182,6 @@ export default class ActivityStore {

@action
public async getFilters() {
this.loading = true;
try {
const filters = await Storage.getItem(ACTIVITY_FILTERS_KEY);
if (filters) {
Expand All @@ -200,16 +195,13 @@ export default class ActivityStore {
}
} catch (error) {
console.log('Loading activity filters failed', error);
} finally {
this.loading = false;
}

return this.filters;
}

@action
public setFilters = async (filters: Filter, locale?: string) => {
this.loading = true;
this.filters = filters;
this.filteredActivity = ActivityFilterUtils.filterActivities(
this.activity,
Expand All @@ -220,8 +212,7 @@ export default class ActivityStore {
activity.determineFormattedRemainingTimeUntilExpiry(locale);
}
});
await Storage.setItem(ACTIVITY_FILTERS_KEY, filters);
this.loading = false;
Storage.setItem(ACTIVITY_FILTERS_KEY, filters);
};

@action
Expand Down
Loading

0 comments on commit bb537cb

Please sign in to comment.