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

Behavior changed in the rendering of primitive values #574

Closed
sqal opened this issue Jan 3, 2020 · 5 comments
Closed

Behavior changed in the rendering of primitive values #574

sqal opened this issue Jan 3, 2020 · 5 comments
Labels
🐞 bug Something isn't working

Comments

@sqal
Copy link
Contributor

sqal commented Jan 3, 2020

Version

3.0.0-alpha.1

Reproduction link

2.x - https://jsfiddle.net/natuqebm/
3.0.0-alpha.1 - https://jsfiddle.net/u7pt6gjo/

Steps to reproduce

Just open these above reproductions links

What is expected?

There is an inconsistency between Vue 2.x and the latest alpha. 3.x should not render a boolean values in the render function.

What is actually happening?

Renders 0falsetrueNaN instead of 0NaN

@posva
Copy link
Member

posva commented Jan 3, 2020

Does it makes sense to pass anything that isn't a string or an h() though (in both versions)?

@sqal
Copy link
Contributor Author

sqal commented Jan 3, 2020

@posva of course, here's an example of what I do all the time when writing components in plain JS

function render() {
  return h('div', [
    // isOpen is boolean
    props.isOpen && h('div', [])
  ])
}

@jacekkarczmarczyk
Copy link
Contributor

jacekkarczmarczyk commented Jan 3, 2020

Also Vue 2.6 allows booleans:

export interface CreateElement {
  (tag?: string | Component<any, any, any, any> | AsyncComponent<any, any, any, any> | (() => Component), children?: VNodeChildren): VNode;
  (tag?: string | Component<any, any, any, any> | AsyncComponent<any, any, any, any> | (() => Component), data?: VNodeData, children?: VNodeChildren): VNode;
}


export type VNodeChildren = VNodeChildrenArrayContents | [ScopedSlot] | string | boolean | null | undefined;

so removing it would be a breaking change

@posva
Copy link
Member

posva commented Jan 3, 2020 via email

@KaelWD
Copy link
Contributor

KaelWD commented Jan 3, 2020

vuejs/vue#8498

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🐞 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants