Skip to content

Commit

Permalink
fix: undefined error when no exlude entities or domains
Browse files Browse the repository at this point in the history
  • Loading branch information
Lebe1ge committed Jan 4, 2025
1 parent 8f45714 commit d9d0df6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/linus-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ class LinusStrategy extends HTMLTemplateElement {
private static createDomainSubviews(views: LovelaceViewConfig[]) {
const exposedViewIds = Helper.getExposedViewIds();
exposedViewIds.forEach(viewId => {
if (Helper.linus_dashboard_config?.excluded_domains.includes(viewId)) return;
if (Helper.linus_dashboard_config?.excluded_device_classes.includes(viewId)) return;
if (Helper.linus_dashboard_config?.excluded_domains?.includes(viewId)) return;
if (Helper.linus_dashboard_config?.excluded_device_classes?.includes(viewId)) return;
if (![...CUSTOM_VIEWS, ...DOMAINS_VIEWS].includes(viewId)) return;
if (DOMAINS_VIEWS.includes(viewId) && (Helper.domains[viewId] ?? []).length === 0) return;

Expand Down
4 changes: 2 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ export async function createChipsFromList(chipsList: string[], chipOptions?: Par
: area_slugs.flatMap(area_slug => Object.keys(Helper.areas[area_slug]?.domains ?? {}));

for (let chipType of chipsList) {
if (Helper.linus_dashboard_config?.excluded_domains.includes(chipType)) continue;
if (Helper.linus_dashboard_config?.excluded_device_classes.includes(chipType)) continue;
if (Helper.linus_dashboard_config?.excluded_domains?.includes(chipType)) continue;
if (Helper.linus_dashboard_config?.excluded_device_classes?.includes(chipType)) continue;
if (!domains.includes(chipType)) continue;

const className = Helper.sanitizeClassName(chipType + "Chip");
Expand Down
4 changes: 2 additions & 2 deletions src/views/AreaView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ class AreaView {


for (const domain of exposedDomainIds) {
if (Helper.linus_dashboard_config?.excluded_domains.includes(domain)) continue;
if (Helper.linus_dashboard_config?.excluded_device_classes.includes(domain)) continue;
if (Helper.linus_dashboard_config?.excluded_domains?.includes(domain)) continue;
if (Helper.linus_dashboard_config?.excluded_device_classes?.includes(domain)) continue;
if (domain === "default") continue;

try {
Expand Down

0 comments on commit d9d0df6

Please sign in to comment.