Wrong merging of props and emits definitions from mixins
Vue version
3.2.47
Link to minimal reproduction
Steps to reproduce
Define props
and emits
definitions as arrays in mixins, and use multiply mixins in a component. The defintions get wrongly merged, because the internal mergeOptions()
helper uses the wrong merge strategies for these fields: mergeObjectOptions
which ends up treating arrays as objects.
Both actually have an empty // TODO
behind them, I imagine it's about this problem, and got forgotten:
What is expected?
The fields should be correctly merged. For props, if one of the encountered props is an object instead of an array, all definitions should be converted to object notation and merged.
props: { "one": {}, "two": { "default": "two" } }
emits: [ "one", "two", "three", "four", "five", "six" ]
What is actually happening?
The arrays are being treated as objects, and their indices become object keys and override each other:
props: { "0": "one", "two": { "default": "two" } }
emits: { "0": "five", "1": "six", "2": "three", "3": "four" }
Thanks @yyx990803! Somewhat related, I'd like to highlight this gnarly bug here in the devtools:
https://github.com/vuejs/devtools/issues/2037
Would be great to get this merged and released soon.