Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Avoid calling update_counters twice

Christophe Bliard58a4db92ef01
diff --git a/frontend/src/app/features/work-packages/components/wp-relations/wp-relations.component.ts b/frontend/src/app/features/work-packages/components/wp-relations/wp-relations.component.ts
index 6c397bc4b3f..66b26d1341c 100644
--- a/frontend/src/app/features/work-packages/components/wp-relations/wp-relations.component.ts
+++ b/frontend/src/app/features/work-packages/components/wp-relations/wp-relations.component.ts
@@ -91,7 +91,7 @@ export class WorkPackageRelationsComponent extends UntilDestroyedMixin implement
this.untilDestroyed(),
)
.subscribe(() => {
- this.updateRelationsTab();
+ this.updateRelationsTabAndCounter();
});
/*
@@ -108,11 +108,6 @@ export class WorkPackageRelationsComponent extends UntilDestroyedMixin implement
document.addEventListener('turbo:submit-end', this.turboFrameListener);
}
- public updateCounter() {
- const url = this.PathHelper.workPackageUpdateCounterPath(this.workPackage.id!, 'relations');
- void this.turboRequests.request(url);
- }
-
private async updateFrontendData(event:CustomEvent) {
if (event) {
// A turbo:submit-end event *has* a `formSubmission` property, but I do not
@@ -133,19 +128,18 @@ export class WorkPackageRelationsComponent extends UntilDestroyedMixin implement
// Refetch relations
await this.wpRelations.require(this.workPackage.id!, true);
this.halEvents.push(this.workPackage, { eventType: 'updated' });
-
- this.updateCounter();
}
}
}
}
- private updateRelationsTab() {
+ private updateRelationsTabAndCounter() {
void this.turboRequests.requestStream(this.turboFrameSrc)
.then((result) => {
renderStreamMessage(result.html);
});
- this.updateCounter();
+ const url = this.PathHelper.workPackageUpdateCounterPath(this.workPackage.id!, 'relations');
+ void this.turboRequests.request(url);
}
}