Subscribe on changes!

v-for on a template which has a comment: throws an error when trying to shuffle the array

avatar
Sep 9th 2020

Version

3.0.0-rc.10

Reproduction link

https://codesandbox.io/s/youthful-sky-is4hc?file=/src/App.vue

Steps to reproduce

  1. Open reproduction link
  2. click on shuffle

What is expected?

Items should be rendered correctly after shuffling the array

What is actually happening?

Getting the following error:

Uncaught (in promise) TypeError: Failed to execute 'insertBefore' on 'Node': parameter 1 is not of type 'Node'.

avatar
Sep 10th 2020

Simply change <template> to <div> or remove ':key="item.id"' will avoid the problem.

Disallow key attribute on <template>

https://eslint.vuejs.org/rules/no-template-key.html

avatar
Sep 10th 2020

@lanezhao that rule is no longer true

avatar
Sep 12th 2020

For me it is happening the same but instead of comment at my first position is "v-if" condition what have "false" value. Which results in <!--v-if--> comment.