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

cannot call Set#intersection for set with Proxy #11398

Open
sevenc-nanashi opened this issue Jul 18, 2024 · 4 comments · May be fixed by #11399
Open

cannot call Set#intersection for set with Proxy #11398

sevenc-nanashi opened this issue Jul 18, 2024 · 4 comments · May be fixed by #11399

Comments

@sevenc-nanashi
Copy link

Vue version

fd5c001

Link to minimal reproduction

https://play.vuejs.org/#eNqlVE1v2zAM/SuELrUBI8HWngInWTf00AHbina3aQfHYVK3smRIcpIi838fJdUf84IMWE8WyafHxw/5yK6rarKrkc1YanJdVBYM2roCkcntnDNrOFtwWZSV0haOoHGTgFX32R4a2GhVwgXdvuCSy1xJY6F8eUALcweMJO6BrOjHuwTeJ3D5M45bWCaVfUR9AuuACVwNsBpNLWwHTemUyrpcoV7AL6jlGjeFxPUi6o50tb28RXsrLWqDuS2UJIrIy//idM5gpZTATL7WdN2p6iIxzBdw5BJ6GZNdJmokpi6fC4d0QuWZ8NwU7xPBMhiRb08giGEWuhXMEUcvpSUaeFq2vos95djneE/L77VOikGLolF+ambDZToN60HLQIbFshKZRbIGzDM4ug1pp7VcAmd9j1hDNA6frmpraRQfclHkz7RkoxlFm0wYTMB/Ytq/O60OL6F1cQLB6suM02kg9GL+SW51PeQejOXt3K/CXYq/dY9H9l+6W+o/ZZ+jTqeDYbGEXjRt2abYTp6MkvTs/W5zlquyKgTqb5XLRq+ehukiLpYJofafvc+raP35I+bPJ/xP5uB8nN3RMqDeIWddzGaaKgvhm4eveKBzFyzVuhaEPhO8R6NE7TQG2EdaMJI9wHm1t/6HVcjtd3NzsChNW5QT6pCNx3NGf69PZ0rv5V5Orvw9eg2s+Q0+UdCt

Steps to reproduce

  1. Create a set with Proxy, such as ref(new Set([...]))
  2. Call Set#intersection

What is expected?

It shouldn't throw an error

What is actually happening?

It throws error: "Set operation called on non-Set object"

System Info

Vue: fd5c001
TypeScript: 5.5.3

Any additional comments?

There is a workaround: toRaw(mySet.value).intersection does not throw error.

@sevenc-nanashi
Copy link
Author

Looks like this issue also applies to some other Set methods:

  • difference
  • isSubsetOf
  • isSupersetOf
  • isDisjointFrom
  • symmetricDifference
  • union

@yyx990803
Copy link
Member

Your version linking to 3.4.32 release note made me think it's a regression, but it seems the behavior has always been like this since Vue 3?

@sevenc-nanashi
Copy link
Author

sevenc-nanashi commented Jul 19, 2024

I can reproduce this issue in Vue 3.2, 3.3 too.
Somehow I couldn't run the code in that playground in Vue 3.0 and 3.1 (even though @vue/compiler-sfc was installed), so I haven't checked that.

@qtencent7
Copy link

我想问一句,set的原生方法intersection不支持带proxy的set,这不是很正常吗?为啥要提issue,而且还有人给解决了?我理解,框架不是自有一套逻辑,为啥要这样兼容各种看似跟框架设计不一样的问题呢,谁能解答一下

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