Skip to content

v-for class with Symbol.iterator not working properly when return value is modified #9414

@plehnen

Description

@plehnen

Version

2.6.0-beta.3

Reproduction link

https://jsfiddle.net/vx1ygurm/

Steps to reproduce

Iterate with v-for on a class with Symbol.iterator (which does something with the returning value). See jsfiddle!

What is expected?

since 2.6-beta1 it should support iterables in v-for (#8179) d40eb9c, (#8179)

I thought, great, let's try this with my footnote class and get rid of that verbose "getItems()" accessor and directly pass the class with a Symbol.iterator.

What is actually happening?

But as soon as the values which should be iterated are mutated before they are returned (e.g. sort), it shows the Vue warn:
"You may have an infinite update loop in a component render function."

And the iterator gets called over 100 times.


Even worse, if you put this class in a vuex state. Then it complains that it cannot be mutated (even though I don't actually mutate it)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions