Subscribe on changes!

Duplicate keys check does not working

avatar
Jan 21st 2021

Version

3.0.5

Reproduction link

https://codesandbox.io/s/vigorous-booth-0sq44?file=/src/App.vue

Steps to reproduce

1、click repoduction link 2、see console 3、click change button 4、see console

What is expected?

should warn duplicate keys

What is actually happening?

no warning appears

avatar
Jan 21st 2021

relate #3078

avatar
May 28th 2021

The diff algorithm is able to handle a lot of fast cases without the need for creating a full key map - and in such cases Vue can correctly update the list even with duplicated keys.

e.g. a b c a -> a a can work even if there are duplicated keys because the head and tail remains the same.

The current duplicate key check only warns when a full key map is needed and the duplicated key leads to ambiguous behavior.

Checking duplicated keys on every update is wasteful even in development so it's best to avoid it.