Skip to content

Activity: improve performance #2772

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading