Dont change config on init#2044
Dont change config on init#2044zsarnett merged 10 commits intohome-assistant:devfrom bramkragten:dont-change-config-on-init
Conversation
| } | ||
|
|
||
| private _changed(ev): void { | ||
| if (!this.hass || this._initializing) { |
There was a problem hiding this comment.
How is it possible that these things are fired before we got rendered? Is that on initialization?
There was a problem hiding this comment.
So is this PR solving problems or fighting symptoms? 😉
In Polymer versions, we would always check if the value was undefined and ignore that one. I wonder if we can do something similar, because adding initialized logic to each place we use a dropdown won't scale.
There was a problem hiding this comment.
Also, instead of using ev.target.value, we can also inspect ev.detail.value, I wonder if it's different.
|
|
||
| protected async firstUpdated(): Promise<void> { | ||
| if (this._initializing) { | ||
| await this.updateComplete; |
There was a problem hiding this comment.
Bit surprised about this, isn't this method called after the first time has been rendered, so awaiting this promise means you wait for 2nd render?
* dont change config on init * set default title empty * used firstUpdated instead of updated * prevent double events * check if val changed * typing * clean * lint * clean * prettier is having a fight
Prevent an edit of the config on init and allows to open the raw yaml