Skip to content

Guard for null badges#3841

Merged
balloob merged 2 commits into
devfrom
null-badges
Oct 2, 2019
Merged

Guard for null badges#3841
balloob merged 2 commits into
devfrom
null-badges

Conversation

@bramkragten
Copy link
Copy Markdown
Member

Fixes #3838

cards: this._cards,
badges: this._badges!.map((entityConf) => entityConf.entity),
...this._config,
badges: this._badges!.map((entityConf) => entityConf.entity),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By adding it below the ...this._config, it will override whatever is in config. Is this on purpose ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the config is the view config with the cards and badges stripped off, so we don't have any duplicates to worry about, just want to keep the order of the yaml somewhat the same.

this._config = viewConfig;
this._badges = badges ? processEditorEntities(badges) : [];
this._badges = badges
? processEditorEntities(badges.filter(Boolean))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of adding guards everywhere, can't we filter it when Lovelace config is loaded ?

Copy link
Copy Markdown
Member

@balloob balloob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful !

@balloob balloob merged commit 7add8a2 into dev Oct 2, 2019
@delete-merged-branch delete-merged-branch Bot deleted the null-badges branch October 2, 2019 16:29
@bramkragten bramkragten mentioned this pull request Oct 2, 2019
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

null badge still causing issues

4 participants