diff --git a/ui-ngx/src/app/core/utils.ts b/ui-ngx/src/app/core/utils.ts index 7be030bf54..6291438a58 100644 --- a/ui-ngx/src/app/core/utils.ts +++ b/ui-ngx/src/app/core/utils.ts @@ -438,6 +438,6 @@ export function generateSecret(length?: number): string { return str.concat(generateSecret(length - str.length)); } -export function validateEntityId(entityId: EntityId): boolean { - return isDefinedAndNotNull(entityId.id) && entityId.id !== NULL_UUID && isDefinedAndNotNull(entityId.entityType); +export function validateEntityId(entityId: EntityId | null): boolean { + return isDefinedAndNotNull(entityId?.id) && entityId.id !== NULL_UUID && isDefinedAndNotNull(entityId?.entityType); } diff --git a/ui-ngx/src/app/modules/home/components/widget/widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/widget.component.ts index d010ea24a0..4caf5f3edd 100644 --- a/ui-ngx/src/app/modules/home/components/widget/widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/widget.component.ts @@ -1015,7 +1015,7 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI const type = descriptor.type; const targetEntityParamName = descriptor.stateEntityParamName; let targetEntityId: EntityId; - if (this.widgetInfo.type !== 'static' && descriptor.setEntityId && validateEntityId(entityId)) { + if (descriptor.setEntityId && validateEntityId(entityId)) { targetEntityId = entityId; } switch (type) {