Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

UI updates: or-select bug fix to fire change event when value is auto set on load

Rich Turner01d61dccee14
diff --git a/ui/component/or-select/src/index.ts b/ui/component/or-select/src/index.ts
index 135061a59..8f5a15730 100644
--- a/ui/component/or-select/src/index.ts
+++ b/ui/component/or-select/src/index.ts
@@ -107,7 +107,7 @@ export class OrSelect extends LitElement {
} else {
index = this.options.findIndex((opt: string | [string, string]) => {
const value = Array.isArray(opt) ? opt[0] : opt;
- return value == val;
+ return value === val;
});
if(this.showEmptyOption) {
@@ -117,7 +117,8 @@ export class OrSelect extends LitElement {
const indexChanged = this._select.selectedIndex != index;
this._select.selectedIndex = index;
- if (indexChanged) {
+
+ if (val !== this.value) {
this.onChange();
} else {
if (this.autoSize) {