Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
DmitryNeposidjaka opened this issue Dec 14, 2017 · 20 comments
Open

Comments

@DmitryNeposidjaka
Copy link

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 ?

@eklundkristoffer
Copy link

eklundkristoffer commented Dec 21, 2017

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

@yyman001
Copy link

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

@yyman001
Copy link

@DmitryNeposidjaka @eklundkristoffer i am find a fix function,more msg look at #27

@yyman001
Copy link

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

@hejianxian
Copy link
Owner

@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.

@Zanzavar
Copy link

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

@awulkan
Copy link
Contributor

awulkan commented Jan 15, 2018

@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.

@JuniorNunes7
Copy link

JuniorNunes7 commented Mar 6, 2018

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>

@kjhatis
Copy link

kjhatis commented Mar 16, 2018

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

After trying your solutiion it still says the same @JuniorNunes7

@hejianxian
Copy link
Owner

hejianxian commented Mar 16, 2018

@kjhatis Try it.

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

@xyz-zz
Copy link

xyz-zz commented Apr 27, 2018

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

@Tanyuta
Copy link

Tanyuta commented Oct 4, 2018

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

@mcisback
Copy link

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

@xiooLoo
Copy link

xiooLoo commented Dec 19, 2018

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不一致就不会有问题了😁

@Lucascoml
Copy link

Lucascoml commented Jun 24, 2019

Has anyone seen solve?

@wenweih
Copy link

wenweih commented Jul 8, 2019

@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?

@eeerrrttty
Copy link

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!

@korsino
Copy link

korsino commented Jun 24, 2020

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 🙌

@marcelodmdo
Copy link

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

@houtianqi-ansin
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests