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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Rewrite portal without async pipe
Oliver Güntherd7cafb913358
diff --git a/frontend/src/app/spot/components/drop-modal/drop-modal-portal.component.ts b/frontend/src/app/spot/components/drop-modal/drop-modal-portal.component.tsindex 2a44d850ce3..a1a3e04bf33 100644--- a/frontend/src/app/spot/components/drop-modal/drop-modal-portal.component.ts+++ b/frontend/src/app/spot/components/drop-modal/drop-modal-portal.component.ts@@ -5,25 +5,48 @@ import {Component,ElementRef,HostBinding,+ ChangeDetectorRef,} from '@angular/core';-import { SpotDropModalTeleportationService } from './drop-modal-teleportation.service';+import {+ SpotDropModalTeleportationService,+ TeleportInstance,+} from './drop-modal-teleportation.service';+import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';export const spotDropModalPortalComponentSelector = 'spot-drop-modal-portal';@Component({selector: spotDropModalPortalComponentSelector,- template: '<ng-container *ngTemplateOutlet="template$ | async"></ng-container>',+ template: '<ng-container *ngTemplateOutlet="template"></ng-container>',changeDetection: ChangeDetectionStrategy.OnPush,})-export class SpotDropModalPortalComponent implements AfterViewChecked {- @HostBinding('class.spot-drop-modal-portal') className = true;+export class SpotDropModalPortalComponent extends UntilDestroyedMixin implements OnInit, AfterViewChecked {+ @HostBinding('class.spot-drop-modal-portal') className = true;++ template:TeleportInstance|null = null;constructor(+ readonly cdRef:ChangeDetectorRef,readonly template$:SpotDropModalTeleportationService,- readonly elementRef:ElementRef,- ) { }+ readonly elementRef:ElementRef<HTMLElement>,+ ) {+ super();+ }++ ngOnInit() {+ this+ .template$+ .templateRef$+ .pipe(+ this.untilDestroyed(),+ )+ .subscribe((templ) => {+ this.template = templ;+ this.cdRef.detectChanges();+ });+ }- ngAfterViewChecked(): void {+ ngAfterViewChecked():void {this.template$.hasRendered$.next(!!this.elementRef.nativeElement.children.length);}}diff --git a/frontend/src/app/spot/components/drop-modal/drop-modal-teleportation.service.ts b/frontend/src/app/spot/components/drop-modal/drop-modal-teleportation.service.tsindex 35fd03ff518..b5ad3196476 100644--- a/frontend/src/app/spot/components/drop-modal/drop-modal-teleportation.service.ts+++ b/frontend/src/app/spot/components/drop-modal/drop-modal-teleportation.service.ts@@ -11,21 +11,19 @@ import { distinctUntilChanged } from 'rxjs/operators';export type TeleportInstance = TemplateRef<any>;@Injectable({ providedIn: 'root' })-export class SpotDropModalTeleportationService extends BehaviorSubject<TeleportInstance|null> {+export class SpotDropModalTeleportationService {++ public templateRef$ = new BehaviorSubject<TeleportInstance|null>(null);public hasRendered$ = new Subject<boolean>();public hasRenderedFiltered$ = this.hasRendered$.pipe(distinctUntilChanged());- constructor() {- super(null);- }-public activate(instance: TeleportInstance) {- this.next(instance);+ this.templateRef$.next(instance);}public clear() {- this.next(null);+ this.templateRef$.next(null);}}