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

surpress error toast when polling

Jonas Jabari2d29aee3b872
diff --git a/frontend/src/app/core/turbo/turbo-requests.service.ts b/frontend/src/app/core/turbo/turbo-requests.service.ts
index 23bae83a6c9..da2ecacc074 100644
--- a/frontend/src/app/core/turbo/turbo-requests.service.ts
+++ b/frontend/src/app/core/turbo/turbo-requests.service.ts
@@ -10,7 +10,7 @@ export class TurboRequestsService {
}
- public request(url:string, init:RequestInit = {}):Promise<{ html:string, headers:Headers }> {
+ public request(url:string, init:RequestInit = {}, suppressErrorToast = false):Promise<{ html:string, headers:Headers }> {
return fetch(url, init)
.then((response) => {
if (!response.ok) {
@@ -26,7 +26,11 @@ export class TurboRequestsService {
return result;
})
.catch((error) => {
- this.toast.addError(error as string);
+ if (!suppressErrorToast) {
+ this.toast.addError(error as string);
+ } else {
+ console.error(error);
+ }
throw error;
});
}
diff --git a/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/index.controller.ts b/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/index.controller.ts
index 955d44d3d96..a712c84fafc 100644
--- a/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/index.controller.ts
+++ b/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/index.controller.ts
@@ -194,7 +194,7 @@ export default class IndexController extends Controller {
headers: {
'X-CSRF-Token': (document.querySelector('meta[name="csrf-token"]') as HTMLMetaElement).content,
},
- });
+ }, true); // suppress error toast in polling to avoid spamming the user when having e.g. network issues
}
private handleUpdateStreamsResponse(html:string, headers:Headers, journalsContainerAtBottom:boolean) {