[2.1.5+]Multiple root nodes from functional component render function not allowed now? #4472

Closed
Uriziel01 opened this Issue Dec 13, 2016 · 4 comments

Projects

None yet

4 participants

@Uriziel01

Vue.js version

2.1.5, 2.1.6

Reproduction Link

[2.1.4] https://jsfiddle.net/uriziel01/kx1yuu3a/ [working]
[2.1.5] https://jsfiddle.net/uriziel01/kx1yuu3a/3/ [broken]

Steps to reproduce

Return array of elements from render function in functional component.

What is Expected?

Multiple root nodes seems to be dissallowed in Vue2 everywhere but not here.
I think that the correct solution would be to throw appropriate error to console and avoid returning undefined. Or is that designed logic and this should be handled by the engine as it was in older versions? You decide.

What is actually happening?

undefined is rendered as a result and no correct error is thrown to the console.

@eachmawzw

I met the same problem, I want to use version 2.1.4, what should I do?

@Uriziel01
Uriziel01 commented Dec 14, 2016 edited

Use 2.1.5+ versions and encapsule all the elements in additional parent like so:

return h('div', {}, [h('label', 'Test123'), h('label', 'Test123')];

Or just revert to 2.1.4 and wait to see what will happen with this Issue.

@eachmawzw

The question has been decided.Thank you so much.

@Darkside73

I use functional component as the only way to get rid of extraneous root component

@yyx990803 yyx990803 closed this in f1c3867 Dec 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment