View Editor: Badge Preview#5335
Conversation
| private _config?: LovelaceBadgeConfig; | ||
|
|
||
| private get _error() { | ||
| return this._element?.tagName === "HUI-ERROR-BADGE"; |
There was a problem hiding this comment.
I'm not sure how to determine if its an error. May need to create a public error on the state label badge.
OR
do we need to do anything special for errors on badges? Maybe just checking if the entity exists?
There was a problem hiding this comment.
It would be a hui-error-card as that is handled in create-element-base
There was a problem hiding this comment.
It looks like we do have an error-badge but it is currently unused.
| try { | ||
| this._element.setConfig(configValue); | ||
| } catch (err) { | ||
| this._createBadge(createErrorBadgeConfig(err.message)); |
There was a problem hiding this comment.
So we have 2 error elements, an error-badge we create here, and an error-card we create when the type is unknown in create-element-base.
The error-badge would only be used here, we should align that with the behavior of hui-view so either make that create an error-badge instead of error-card or create an error-card here.
There was a problem hiding this comment.
Will this even ever catch the error? As we catch it here: https://github.com/home-assistant/frontend/blob/dev/src/panels/lovelace/create-element/create-element-base.ts#L62-L66
There was a problem hiding this comment.
No it doesnt ever seem to hit it :)

Proposed change
Preview Badges in the View Editor
Type of change
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: