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

Vue does not accept undefined values when returning an array in functional component #7282

Closed
Labels

Comments

@sqal
Copy link
Contributor

sqal commented Dec 19, 2017

Version

2.5.11

Reproduction link

https://jsfiddle.net/qL80y6oL/

Steps to reproduce

Check console log.

What is expected?

Should render input element

What is actually happening?

When functional component returns an array and the array contains other values besides vnodes like e.g. null or undefined Vue will not render anything and throw an error.


I checked this in few previous versions and it seems that it never worked correctly. In 2.5.9 I get a different warning "Cannot set property 'isRootInsert' of null". So the question is. Is this a case that should be handled by Vue internally, or do I have to be careful and not to return null/undefined values in returned array.

@posva
Copy link
Member

posva commented Dec 19, 2017

The array must contain vnodes, so only things created with h (or createElement) but it's weird because I was expecting to find more information in the typings but we only allow returning vnode there, not arrays so now I don't know if the typing are wrong and this was never intended or if it was just forgotten for the typings

@yyx990803 yyx990803 added the bug label Dec 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment