Tree Picker: Ensure min/max are numeric
There is a scenario where the `config.getValueByAlias('maxNumber')`
would return as a `string`. This would cause issues further down when
they are strongly-typed compared, e.g. `max === 1` would be false.
I experienced this issue with the Tree Picker, for setting the
`multiple` property value.
This commit is contained in:
committed by
Jacob Overgaard
parent
35bbc472a6
commit
6c76b0292b
@@ -45,8 +45,10 @@ export class UmbPropertyEditorUITreePickerElement extends UmbLitElement implemen
|
||||
this.startNodeId = startNode.id;
|
||||
}
|
||||
|
||||
this.min = config?.getValueByAlias('minNumber') || 0;
|
||||
this.max = config?.getValueByAlias('maxNumber') || 0;
|
||||
// TODO: The value from `config.getValueByAlias('maxNumber')` could be a `string`, can't be cast as a `number`. [LK]
|
||||
// This causes issues when the `max` value is compared against other numbers, e.g. `max === 1` would be false.
|
||||
this.min = Number(config?.getValueByAlias('minNumber')) || 0;
|
||||
this.max = Number(config?.getValueByAlias('maxNumber')) || 0;
|
||||
|
||||
this.filter = config?.getValueByAlias('filter');
|
||||
this.showOpenButton = config?.getValueByAlias('showOpenButton');
|
||||
|
||||
Reference in New Issue
Block a user