Subscribe on changes!

Collections add/set exposes raw target

avatar
Oct 30th 2020

Version

3.0.2

Reproduction link

https://jsfiddle.net/v9k3jmog/

Steps to reproduce

Call Set::add or Map::set. Those methods are specified to return the collection itself, so they can be chained: set.add(1).add(2).add(3).

What is expected?

Those methods should return the reactive collection so that set.add(1) === set is true and reactivity works when chaining.

What is actually happening?

Those methods return the raw collection, breaking the collections contracts and breaking reactivity.


I pointed a few other things that are less clear-cut bugs but probably not desirable behaviors (e.g. observable differences between reactive and non-reactive collections behaviors) here: https://github.com/vuejs/vue-next/commit/50adc014f59a7f385c836014abb059ec72c52239

avatar
Oct 31st 2020

Added a PR for the reported problem.

Concerning your comments about the other details, I'd suggest to open a new issue (or several). The commits you commented on are a couple months old now, we might need a central place to discuss them.