Skip to content

Commit

Permalink
Fix unused entities view (#22274)
Browse files Browse the repository at this point in the history
Fix compute-unused-entities when using sections
  • Loading branch information
wendevlin authored Oct 7, 2024
1 parent 619f9f7 commit a35b437
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/panels/lovelace/common/compute-unused-entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,16 @@ const addEntities = (entities: Set<string>, obj) => {
if (obj.badges && Array.isArray(obj.badges)) {
obj.badges.forEach((badge) => addEntityId(entities, badge));
}
if (obj.sections && Array.isArray(obj.sections)) {
obj.sections.forEach((section) => addEntities(entities, section));
}
};

export const computeUsedEntities = (config: LovelaceConfig): Set<string> => {
const entities = new Set<string>();
config.views.forEach((view) => addEntities(entities, view));
config.views.forEach((view) => {
addEntities(entities, view);
});
return entities;
};

Expand Down

0 comments on commit a35b437

Please sign in to comment.