File tree Expand file tree Collapse file tree 1 file changed +16
-8
lines changed
Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -278,16 +278,24 @@ export default {
278278 const answer = { ... this .answer }
279279 answer .text = value
280280
281- // Dispatched for creation. Marked as synced
282- this .$set (this .answer , ' local' , false )
283- const newAnswer = await this .createAnswer (answer)
281+ // Prevent any queued debounced PATCHes from running while creating
282+ this .queue .pause ()
283+ try {
284+ // Dispatched for creation. Marked as synced
285+ this .$set (this .answer , ' local' , false )
286+ const newAnswer = await this .createAnswer (answer)
284287
285- // Forward changes, but use current answer.text to avoid erasing
286- // any in-between changes while creating the answer
287- newAnswer .text = this .$refs .input .value
288- this .localText = ' '
288+ // Forward changes, but use current answer.text to avoid erasing
289+ // any in-between changes while creating the answer
290+ newAnswer .text = this .$refs .input .value
291+ this .localText = ' '
289292
290- this .$emit (' create-answer' , this .index , newAnswer)
293+ this .$emit (' create-answer' , this .index , newAnswer)
294+ } finally {
295+ // Clear pending update tasks (stale PATCHes) before resuming processing
296+ this .queue .clear ()
297+ this .queue .start ()
298+ }
291299 },
292300
293301 /**
You can’t perform that action at this time.
0 commit comments