Fix uncaught keyFunction errors when data table filtering (#20285)

* Undefined keys

* Apply suggestion

Co-authored-by: Bram Kragten <mail@bramkragten.nl>

* Prettier

---------

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
Simon Lamon 2024-03-30 14:44:59 +01:00 committed by GitHub
parent f13dcb4139
commit f3ba6e7996
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -386,7 +386,7 @@ export class HaDataTable extends LitElement {
`;
}
private _keyFunction = (row: DataTableRowData) => row[this.id] || row;
private _keyFunction = (row: DataTableRowData) => row?.[this.id] || row;
private _renderRow = (row: DataTableRowData, index: number) => {
// not sure how this happens...