Developer tools action fixes (#24876)

This commit is contained in:
Bram Kragten 2025-04-01 12:18:04 +02:00 committed by GitHub
parent a23f57256c
commit cd39e2d0f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -511,7 +511,20 @@ class HaPanelDevAction extends LitElement {
return; return;
} }
this._yamlValid = true; this._yamlValid = true;
this._serviceDataChanged(ev);
if (typeof ev.detail.value !== "object") {
return;
}
if (this._serviceData?.action !== ev.detail.value.action) {
this._error = undefined;
}
this._serviceData = migrateAutomationAction(
ev.detail.value
) as ServiceAction;
this._checkUiSupported();
} }
private _checkUiSupported() { private _checkUiSupported() {
@ -547,18 +560,18 @@ class HaPanelDevAction extends LitElement {
if (this._serviceData?.action !== ev.detail.value.action) { if (this._serviceData?.action !== ev.detail.value.action) {
this._error = undefined; this._error = undefined;
} }
this._serviceData = migrateAutomationAction( this._serviceData = ev.detail.value;
ev.detail.value
) as ServiceAction;
this._checkUiSupported(); this._checkUiSupported();
} }
private _serviceChanged(ev) { private _serviceChanged(ev) {
ev.stopPropagation(); ev.stopPropagation();
this._serviceData = { action: ev.detail.value || "", data: {} }; if (ev.detail.value) {
this._serviceData = { action: ev.detail.value, data: {} };
this._yamlEditor?.setValue(this._serviceData);
}
this._response = undefined; this._response = undefined;
this._error = undefined; this._error = undefined;
this._yamlEditor?.setValue(this._serviceData);
this._checkUiSupported(); this._checkUiSupported();
} }