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

Iterator helper methods are undefined using reactive proxy #12634

Closed
c-harding opened this issue Jan 2, 2025 · 3 comments
Closed

Iterator helper methods are undefined using reactive proxy #12634

c-harding opened this issue Jan 2, 2025 · 3 comments

Comments

@c-harding
Copy link

Vue version

3.5.13

Link to minimal reproduction

https://play.vuejs.org/#eNp9ktFLwzAQxv+VEB+6QemQ6cscgsoe5oOK8zEgpbvVzDQJyaUrjP7vXlpWh257y9139/WXr9nzB2uzOgCf8bkvnLTIPGCw90LLyhqHbM8c5AXKGljLNs5ULKH55E5ooQujvVGQKVOOkiWCy9G4K28qYNBIjz5JNezYCnA0zupcBfB0iPr44vLagGfaYO+SpAeC0eD23+6cYZXbAYadoCH9LEzc/csyxHESpnebT/osKUUqECqrcgSq5pOjgqccPX14I8ts642mf7AXmjHBC1NZqcC9WpQEJviMdUrUcqXM7rnroQuQHvrFFxTfJ/pb38Se4G8OPLgaBB80zF0J2MuL1Qs0dB7EyqyDoukL4jtQaCEy9mOPQa8J+2iuo112L0nq8sMvGgTtD5eKoHGy7eYFp4f1dOHqv7jT7KbbE7qlFD9rcNGTApxmt9n1lLc/l1P2tg==

Steps to reproduce

Call an iterator helper method, e.g. new Set([1,2]).values().some(value => value > 5). This works (in modern browsers, see MDN).

For typescript, this is available in es2024.

Now use a reactive object to do the same (reactive(new Set([1,2])).values().some(value => value > 5)). This should behave the same, but instead undefined is not a function, despite it typechecking in TypeScript.

What is expected?

reactive(new Set(...)) should offer exactly the same interface as new Set(...).

An ideal futureproof solution would be that any method is called through, if it has not been patched.

What is actually happening?

TypeError: undefined is not a function.

In the reproduction link, I have logged two different methods, with and without reactive. When using reactive, undefined is logged instead of the desired method.

System Info

Tested in Firefox 133.0.3 on macOS. Occurs in the playground (see link above).

Any additional comments?

No response

@Bayn-Web
Copy link

Bayn-Web commented Jan 2, 2025

See this. Vue dropped rest of the function except next.

@c-harding
Copy link
Author

Yup, that's definitely the offending code. I suspect this could be fixed with Object.assign(Object.create(Iterator), {…})

@edison1105
Copy link
Member

duplicate of #12615

@edison1105 edison1105 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 2, 2025
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

3 participants