From 64338cb87c9d354c89ad1f192a231e1a63912b60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Kreml=C3=A1=C4=8Dek?= Date: Tue, 16 Jan 2024 10:16:18 +0100 Subject: [PATCH] Fix #14525 reading properties of undefined during EditableColumn changes (#14527) * Fix #14525 reading properties of undefined during EditableColumn changes SimpleChanges might not have `data` defined when only other input than `data` changes. * refactor: use optional chaining for shorter syntax --- src/app/components/table/table.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/components/table/table.ts b/src/app/components/table/table.ts index 2ede18e55d5..b883d69d3b7 100644 --- a/src/app/components/table/table.ts +++ b/src/app/components/table/table.ts @@ -4063,8 +4063,8 @@ export class EditableColumn implements OnChanges, AfterViewInit, OnDestroy { constructor(public dt: Table, public el: ElementRef, public zone: NgZone) {} - public ngOnChanges({ data }: SimpleChanges): void { - if (this.el.nativeElement && !data.firstChange) { + public ngOnChanges(changes: SimpleChanges): void { + if (this.el.nativeElement && (!changes.data?.firstChange)) { this.dt.updateEditingCell(this.el.nativeElement, this.data, this.field, this.rowIndex); } }