Discussion icon indicating copy to clipboard operation
Discussion copied to clipboard

Duplicate objects are not supported in v-repeat.

Open Anshul-Batra opened this issue 10 years ago • 7 comments

Hi ,

I am getting below warning in my application:

[Vue warn]: Duplicate objects are not supported in v-repeat.

Could you please tell me what does this warning means and what are possible reasons for this error. Because of this warning i am getting error el is null and my page doesn't get load.

i am getting this error only in mozilla firefox... In chrome it is working fine.

Anshul-Batra avatar Sep 01 '15 16:09 Anshul-Batra

@yyx990803

Hi Evan,

Please let me know the reason for the same

Thanks, Anshul

Anshul-Batra avatar Sep 01 '15 17:09 Anshul-Batra

@Anshul-Batra could you please prove a demo of this working in chrome but breaking in firefox? You can start from this: https://jsfiddle.net/simplesmiler/9zegjc4g/13/ ([email protected]).

simplesmiler avatar Sep 01 '15 19:09 simplesmiler

Hi @simplesmiler ,

our is a very big project splitted in multiple files and that too is client confidential... Cannot disclose. Also, i don't know in which part i am getting error.. otherwise i could have posted that part only.. If you could tell me the possible reasons for this error, it will help me to figure out the solutions.

Thanks, Anshul

Anshul-Batra avatar Sep 02 '15 05:09 Anshul-Batra

I've come across this error several times. And every time there was a problem with the underlying data-structure. Either you have a track-by id that is used (= in your data) twice, or you don't use track-by and you iterate over a list of objects in which an object is referenced twice.

nirazul avatar Sep 02 '15 05:09 nirazul

I am not using track-by in my application and i have check my object on which i am doing v-repeat but there is no duplicate object... could you please tell me how to figure it out

Anshul-Batra avatar Sep 02 '15 05:09 Anshul-Batra

@Anshul-Batra you'll have to pinpoint the issue yourself. I suggest making a separate branch, and gradually removing component by component until there's no warning in the console. The last component you would have removed is the problematic one.

simplesmiler avatar Sep 02 '15 12:09 simplesmiler

+1

I got this message:

[Vue warn]: Duplicate objects found in v-repeat="rows": {"result":"success","kcal":{"carbs":20.721797323135753,"fibres":0,"protein":29.498087954110897,"total":164.29732313575525,"fat":114.0774378585086,"alcohol":0},"totalWeight":60,"ingredientText":"1 st korv","kJ":{"carbs":86.69999999999999,"fibres":0,"protein":123.42,"total":687.4200000000001,"fat":477.3,"alcohol":0},"grams":{"carbs":5.1,"fibres":0,"protein":7.26,"total":25.259999999999998,"fat":12.9,"alcohol":0},"maxKcal":"largestCellKcal"}

when the real issue was that I had a watch that blew (findLargestKcalCell wasn't in scope):

  created: () ->
    @$watch(
        () -> @rows,
        (newVal, oldVal) -> largestCellKcal = findLargestKcalCell(newVal)
      )

I got no message pointing to this code, but this error message + a few others like: "Cannot read property '__v_trans' of null" and "Uncaught Error: [vue] async stack trace" from vue internals.

hedefalk avatar Oct 15 '15 09:10 hedefalk