Skip to content

Commit

Permalink
fix(#121): fix for hidden error msg
Browse files Browse the repository at this point in the history
  • Loading branch information
MindFreeze committed Oct 31, 2023
1 parent f04557a commit 0f5a03f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export class Chart extends LitElement {
@state() private highlightedEntities: EntityConfigInternal[] = [];
@state() private lastUpdate = 0;
@state() public zoomEntity?: EntityConfigInternal;
@state() public error?: Error;

// https://lit.dev/docs/components/lifecycle/#reactive-update-cycle-performing
protected shouldUpdate(changedProps: PropertyValues): boolean {
Expand Down Expand Up @@ -86,7 +87,8 @@ export class Chart extends LitElement {
ent.children.forEach(childId => {
const child = this.config.sections[sectionIndex + 1]?.entities.find(e => e.entity_id === childId);
if (!child) {
throw new Error(localize('common.missing_child') + ' ' + childId);
this.error = new Error(localize('common.missing_child') + ' ' + childId);
throw this.error;
}
const connection: ConnectionState = {
parent: ent,
Expand Down Expand Up @@ -447,6 +449,9 @@ export class Chart extends LitElement {
// https://lit.dev/docs/components/rendering/
protected render(): TemplateResult | void {
try {
if (this.error) {
throw this.error;
}
this.entityStates.clear();
const containerClasses = classMap({
container: true,
Expand Down

0 comments on commit 0f5a03f

Please sign in to comment.