Skip to content

Commit

Permalink
fix setting wake word to first option everytime (#18121)
Browse files Browse the repository at this point in the history
  • Loading branch information
bramkragten authored Oct 5, 2023
1 parent c106a0a commit 48593ee
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ export class AssistPipelineDetailWakeWord extends LitElement {
changedProps.has("data") &&
changedProps.get("data")?.wake_word_entity !== this.data?.wake_word_entity
) {
if (this.data?.wake_word_id) {
if (
changedProps.get("data")?.wake_word_entity &&
this.data?.wake_word_id
) {
fireEvent(this, "value-changed", {
value: { ...this.data, wake_word_id: undefined },
});
Expand Down Expand Up @@ -140,8 +143,9 @@ export class AssistPipelineDetailWakeWord extends LitElement {
}
this._wakeWords = wakewordInfo.wake_words;
if (
!this.data?.wake_word_id ||
!this._wakeWords.some((ww) => ww.id === this.data!.wake_word_id)
this.data &&
(!this.data?.wake_word_id ||
!this._wakeWords.some((ww) => ww.id === this.data!.wake_word_id))
) {
fireEvent(this, "value-changed", {
value: { ...this.data, wake_word_id: this._wakeWords[0]?.id },
Expand Down

0 comments on commit 48593ee

Please sign in to comment.