Skip to content

Commit

Permalink
Fix #14525 reading properties of undefined during EditableColumn chan…
Browse files Browse the repository at this point in the history
…ges (#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
  • Loading branch information
Jakub Kremláček authored Jan 16, 2024
1 parent 0c28c0c commit 64338cb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/app/components/table/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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, <number>this.rowIndex);
}
}
Expand Down

0 comments on commit 64338cb

Please sign in to comment.