Updated 'validateEntityId' logic
This commit is contained in:
parent
596b8cc647
commit
ae7897366d
@ -438,6 +438,6 @@ export function generateSecret(length?: number): string {
|
|||||||
return str.concat(generateSecret(length - str.length));
|
return str.concat(generateSecret(length - str.length));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function validateEntityId(entityId: EntityId): boolean {
|
export function validateEntityId(entityId: EntityId | null): boolean {
|
||||||
return isDefinedAndNotNull(entityId.id) && entityId.id !== NULL_UUID && isDefinedAndNotNull(entityId.entityType);
|
return isDefinedAndNotNull(entityId?.id) && entityId.id !== NULL_UUID && isDefinedAndNotNull(entityId?.entityType);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1015,7 +1015,7 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI
|
|||||||
const type = descriptor.type;
|
const type = descriptor.type;
|
||||||
const targetEntityParamName = descriptor.stateEntityParamName;
|
const targetEntityParamName = descriptor.stateEntityParamName;
|
||||||
let targetEntityId: EntityId;
|
let targetEntityId: EntityId;
|
||||||
if (this.widgetInfo.type !== 'static' && descriptor.setEntityId && validateEntityId(entityId)) {
|
if (descriptor.setEntityId && validateEntityId(entityId)) {
|
||||||
targetEntityId = entityId;
|
targetEntityId = entityId;
|
||||||
}
|
}
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user