Skip to content

reactive iterators do not support iterator helpers #13504

Closed as duplicate of#12615
@c-harding

Description

@c-harding

Vue version

v3.5.17 (also v3.4.38 and 5f8314c)

Link to minimal reproduction

https://play.vuejs.org/#eNq1U8tu2zAQ/BWCF0mAIDdIiwKpbCAtfGiBPtD2JgoFq6xtxhJJ8CE7EPTvXYpR6kNs5JIbuTO7O7NcDvRW66L3QG9oaRsjtCMWnNek5XK7ZNRZRldMik4r48hADPDGiR7ISDZGdSTB3OQDk0w2SlqHuPWts2RJJBzIrTH8oaysM0Jucy/3Uh1kvTrhgzHKvITuzAMZmCQk5nVcPyZ95TqtqoQn+VWdV8nfJH9T1xnmkFlMob3dpVVyEG6nfNAYPSR57FgEJylWLADbCLBpVmxE68CkabXP+zpbrvosqzMmR9Jw1+xICllUE/Vf6ABTWnBwxsPMTc+bOevmla0856NcxDXBpcCLg0633AHeCCn16mfUeEOG4VHuOJYLPcPrqUVAY7MZLBcnhWiOW4cT2ohtcW+VxNWc9DHaqE6LFsx37QROkFGsFJCA8bZVhy9TzBkP+RxvdtDsn4nf22OIMfoDhYLpgdEnzHGzBRfh9a9vcMTzE9ipO98i+wKIU1CtDxoj7aOXdyj7hDep/Tx9Klz133Z9dCDtbCoIDcxx4jOKf+zTBev/5V4Xb6c8fCmc4p8eTKiJA7wu3hVX7+n4D4M8VV4=

Steps to reproduce

  1. Create a reactive map (reactive(new Map()))
  2. Call a method on the map that returns an iterator (map.entries())
  3. Call a helper method on this iterator, e.g. map.entries().filter() (as defined in https://github.com/tc39/proposal-iterator-helpers, now stable and supported by all major browsers).

Workaround: call Iterator.from(map.entries()).filter()

What is expected?

The method should work, just like if the map had not been reactive.

What is actually happening?

The method is not defined.

System Info

Tested the playground link in Firefox 139.0.4 and Chrome 137.0.7151.104 on macOS 15.5.

Any additional comments?

The fix should be fairly simple: if Iterator.from is defined, Vue should call Iterator.from on the object it would otherwise return from any methods it defines returning an iterator, e.g. map.entries, set.values.

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