ov-components: add null check for participant name updates in pre-join component and participant name directive

master
Carlos Santos 2025-03-12 19:03:14 +01:00
parent 2acf636842
commit 6137bdbbbc
2 changed files with 6 additions and 5 deletions

View File

@ -128,7 +128,7 @@ export class PreJoinComponent implements OnInit, OnDestroy {
} }
onParticipantNameChanged(name: string) { onParticipantNameChanged(name: string) {
this.participantName = name; if (name) this.participantName = name;
} }
onEnterPressed() { onEnterPressed() {
@ -151,6 +151,7 @@ export class PreJoinComponent implements OnInit, OnDestroy {
// this.cd.markForCheck(); // this.cd.markForCheck();
}); });
this.libService.participantName$.subscribe((value: string) => { this.libService.participantName$.subscribe((value: string) => {
console.warn('participantName', value);
if (value) this.participantName = value; if (value) this.participantName = value;
// this.cd.markForCheck(); // this.cd.markForCheck();
}); });

View File

@ -1,4 +1,4 @@
import { Directive, ElementRef, Input, OnDestroy, OnInit } from '@angular/core'; import { AfterViewInit, Directive, ElementRef, Input, OnDestroy, OnInit } from '@angular/core';
import { CaptionsLangOption } from '../../models/caption.model'; import { CaptionsLangOption } from '../../models/caption.model';
// import { CaptionService } from '../../services/caption/caption.service'; // import { CaptionService } from '../../services/caption/caption.service';
import { OpenViduComponentsConfigService } from '../../services/config/directive-config.service'; import { OpenViduComponentsConfigService } from '../../services/config/directive-config.service';
@ -490,7 +490,7 @@ export class LangOptionsDirective implements OnDestroy {
@Directive({ @Directive({
selector: 'ov-videoconference[participantName]' selector: 'ov-videoconference[participantName]'
}) })
export class ParticipantNameDirective implements OnInit { export class ParticipantNameDirective implements AfterViewInit, OnDestroy {
/** /**
* @ignore * @ignore
*/ */
@ -509,7 +509,7 @@ export class ParticipantNameDirective implements OnInit {
/** /**
* @ignore * @ignore
*/ */
ngOnInit(): void { ngAfterViewInit(): void {
this.update(this.participantName); this.update(this.participantName);
} }
@ -531,7 +531,7 @@ export class ParticipantNameDirective implements OnInit {
* @ignore * @ignore
*/ */
update(value: string) { update(value: string) {
this.libService.setParticipantName(value); if (value) this.libService.setParticipantName(value);
} }
} }