Skip to content

Commit

Permalink
Fix uncaught keyFunction errors when data table filtering (#20285)
Browse files Browse the repository at this point in the history
* Undefined keys

* Apply suggestion

Co-authored-by: Bram Kragten <[email protected]>

* Prettier

---------

Co-authored-by: Bram Kragten <[email protected]>
  • Loading branch information
silamon and bramkragten authored Mar 30, 2024
1 parent f13dcb4 commit f3ba6e7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/data-table/ha-data-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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...
Expand Down

0 comments on commit f3ba6e7

Please sign in to comment.