Skip to content

Commit

Permalink
more fixes for new options
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Hartmann <chris-hartmann@gmx.de>
  • Loading branch information
Chartman123 committed Feb 14, 2025
1 parent efc555b commit 333fec2
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions src/components/Questions/AnswerInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
ref="input"
:aria-label="ariaLabel"
:placeholder="placeholder"
:value="localAnswer.text"
:value="answer.text"
class="question__input"
:class="{ 'question__input--shifted': !isDropdown }"
:maxlength="maxOptionLength"
Expand Down Expand Up @@ -129,7 +129,6 @@ export default {
return {
queue: null,
debounceOnInput: null,
localAnswer: this.answer,
}
},

Expand Down Expand Up @@ -159,16 +158,7 @@ export default {
this.queue = new PQueue({ concurrency: 1 })

// As data instead of method, to have a separate debounce per AnswerInput
this.debounceOnInput = pDebounce(() => {
return this.queue.add(() => this.onInput())
}, 500)
},

created() {
this.queue = new PQueue({ concurrency: 1 })

// As data instead of method, to have a separate debounce per AnswerInput
this.debounceOnInput = pDebounce(() => {
this.debounceOnInput = debounce(() => {
return this.queue.add(() => this.onInput())
}, 500)
},
Expand Down Expand Up @@ -201,15 +191,11 @@ export default {
// Forward changes, but use current answer.text to avoid erasing
// any in-between changes while creating the answer
newAnswer.text = this.$refs.input.value
this.$emit('update:answer', answer.id, newAnswer)
this.$emit('update:answer', newAnswer)
} else {
await this.updateAnswer(answer)
this.$emit('update:answer', answer.id, answer)
this.$emit('update:answer', answer)
}

// Forward changes, but use current answer.text to avoid erasing any in-between changes
this.localAnswer = { ...response, text: this.localAnswer.text }
this.$emit('update:answer', this.localAnswer)
},

/**
Expand Down

0 comments on commit 333fec2

Please sign in to comment.