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

Performace improvement with Promise.resolve

Aleix Suau78cf2a2a869f
diff --git a/frontend/src/app/globals/dynamic-bootstrapper.ts b/frontend/src/app/globals/dynamic-bootstrapper.ts
index 06858cfcfa2..64dea285ff7 100644
--- a/frontend/src/app/globals/dynamic-bootstrapper.ts
+++ b/frontend/src/app/globals/dynamic-bootstrapper.ts
@@ -82,17 +82,11 @@ export class DynamicBootstrapper {
* @param {OptionalBootstrapDefinition[]|undefined} definitions An optional set of components to bootstrap
*/
public static bootstrapOptionalEmbeddable(appRef:ApplicationRef, element:HTMLElement, definitions = this.optionalBoostrapComponents) {
- // Avoid bootstrapping the embedded components while the app
- // is running the Change Detection ("ApplicationRef.tick
- // is called recursively" error)
- appRef
- .isStable
- .pipe(
- filter(isStable => isStable),
- take(1),
- )
- .toPromise()
- .then(() => this.performBootstrap(appRef, element, true, definitions));
+ // Delay the execution to avoid bootstrapping the embedded components while
+ // the app is running the Change Detection ("ApplicationRef.tick is called recursively"
+ // error) caused because of bootstrapOptionalEmbeddable and bootstrapOptionalDocument
+ // calling this.performBootstrap at the same time
+ Promise.resolve().then(() => this.performBootstrap(appRef, element, true, definitions));
}
/**