vddl icon indicating copy to clipboard operation
vddl copied to clipboard

Duplicate keys detected: { key }. This may cause an update error.

Open DmitryNeposidjaka opened this issue 7 years ago • 20 comments

Hi, thanks for your great component!! I have caught a an error while trying to use your demo https://github.com/hejianxian/vddl/blob/master/example/src/views/simple.vue print of error: _107 How can I fix it? what more information I cant present to you ?

DmitryNeposidjaka avatar Dec 14 '17 10:12 DmitryNeposidjaka

I'm currently experiencing this as well, did you manage to solve it yet?

eklundkristoffer avatar Dec 21 '17 20:12 eklundkristoffer

我使用内嵌electron 调用也是一样会出现这个问题,web没发现这个问题

yyman001 avatar Dec 22 '17 10:12 yyman001

@DmitryNeposidjaka @eklundkristoffer i am find a fix function,more msg look at https://github.com/hejianxian/vddl/issues/27

yyman001 avatar Dec 23 '17 08:12 yyman001

@eklundkristoffer @DmitryNeposidjaka @hejianxian 这次是发现了导致这个bug的原因和暂时解决方案。

yyman001 avatar Dec 23 '17 12:12 yyman001

@DmitryNeposidjaka @eklundkristoffer

In the newer version of vue, this error message does appear. I will find a way to fix this problem as soon as possible. Or you can lower the vue version first.

hejianxian avatar Dec 23 '17 16:12 hejianxian

Same problem here. Unfortunately i cannot downgrade as i need to use Vue 2.5 in order to implement subscribing to actions.

Zanzavar avatar Dec 30 '17 18:12 Zanzavar

@Zanzavar I think it was somewhere around 2.5.9 that this error log was introduced. So you can still be on 2.5.

Anyway, this error was probably always in VDDL, in the new Vue version they just decided to log it afaik.

awulkan avatar Jan 15 '18 19:01 awulkan

I solved this problem defining a unique prefix to key:

<div v-for="(item, i) in items" :key="i"></div>

<div v-for="(item, i) in items2" :key="`A-${i}`"></div>

<div v-for="(item, i) in items3" :key="`B-${i}`"></div>

JuniorNunes7 avatar Mar 06 '18 13:03 JuniorNunes7

[Vue warn]: Duplicate keys detected: 'A-1'. This may cause an update error. 

After trying your solutiion it still says the same @JuniorNunes7

kjhatis avatar Mar 16 '18 10:03 kjhatis

@kjhatis Try it.

https://github.com/hejianxian/vddl#warning

hejianxian avatar Mar 16 '18 15:03 hejianxian

Even if the value of the key is changed, the only existing ID attribute will still be wrong

xyz-zz avatar Apr 27 '18 09:04 xyz-zz

Thank u, @JuniorNunes7, it solved my problem too.

Tanyuta avatar Oct 04 '18 09:10 Tanyuta

I solved this problem defining a unique prefix to key:

<div v-for="(item, i) in items" :key="i"></div>

<div v-for="(item, i) in items2" :key="`A-${i}`"></div>

<div v-for="(item, i) in items3" :key="`B-${i}`"></div>

thanks so much ! This solved my issue :D

mcisback avatar Dec 16 '18 17:12 mcisback

I solved this problem defining a unique prefix to key:

<div v-for="(item, i) in items" :key="i"></div>

<div v-for="(item, i) in items2" :key="`A-${i}`"></div>

<div v-for="(item, i) in items3" :key="`B-${i}`"></div>

谢谢了, 很有效果, 只要保证Array的:key不一致就不会有问题了😁

xiooLoo avatar Dec 19 '18 10:12 xiooLoo

Has anyone seen solve?

Lucascoml avatar Jun 24 '19 01:06 Lucascoml

@Lucascoml

add index for v-for when iterator

like <div v-for="(item, index) in items" :key="`item-${index}`"></div>

V-for with simple arrays: what key to use?

wenweih avatar Jul 08 '19 08:07 wenweih

I solved this problem defining a unique prefix to key:

<div v-for="(item, i) in items" :key="i"></div>

<div v-for="(item, i) in items2" :key="`A-${i}`"></div>

<div v-for="(item, i) in items3" :key="`B-${i}`"></div>

Best answer, worked here!

eeerrrttty avatar Dec 20 '19 00:12 eeerrrttty

I solved this problem defining a unique prefix to key:

<div v-for="(item, i) in items" :key="i"></div>

<div v-for="(item, i) in items2" :key="`A-${i}`"></div>

<div v-for="(item, i) in items3" :key="`B-${i}`"></div>

Worked! Thank you 🙌

korsino avatar Jun 24 '20 07:06 korsino

In determinated case, we can have: post list (5 per page) when you create a new post, and append (or prepend) to reactive array, a new element is accounted for. When you scroll after that, you will see that have duplicated object (retrieved from backend, 6 insted 5) thats the error

marcelodmdo avatar Oct 10 '20 06:10 marcelodmdo

I solved this problem defining a unique prefix to key:

<div v-for="(item, i) in items" :key="i"></div>

<div v-for="(item, i) in items2" :key="`A-${i}`"></div>

<div v-for="(item, i) in items3" :key="`B-${i}`"></div>

Thank you, I solved it.

houtianqi-ansin avatar Dec 06 '20 06:12 houtianqi-ansin