From f3ba6e799620995809613265906f28072ee52cbe Mon Sep 17 00:00:00 2001 From: Simon Lamon <32477463+silamon@users.noreply.github.com> Date: Sat, 30 Mar 2024 14:44:59 +0100 Subject: [PATCH] Fix uncaught keyFunction errors when data table filtering (#20285) * Undefined keys * Apply suggestion Co-authored-by: Bram Kragten * Prettier --------- Co-authored-by: Bram Kragten --- src/components/data-table/ha-data-table.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/data-table/ha-data-table.ts b/src/components/data-table/ha-data-table.ts index cf442f525f..fbd6d97281 100644 --- a/src/components/data-table/ha-data-table.ts +++ b/src/components/data-table/ha-data-table.ts @@ -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...