Skip to content

Children in slot not rerendering #3386

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

Closed
blocka opened this issue Aug 4, 2016 · 3 comments
Closed

Children in slot not rerendering #3386

blocka opened this issue Aug 4, 2016 · 3 comments

Comments

@blocka
Copy link

blocka commented Aug 4, 2016

Vue.js version

^2.0.0-beta.5

Reproduction Link

https://jsfiddle.net/chrisvfritz/rpmce1v8/

Steps to reproduce

Have one or more branches of code where the same component is rendered with different children. Subsequent renders of one of the other branches, will not show the new children.

return this.inner1 
        ? h(Outer, () => 'Inner1') 
      : h(Outer, () => 'Inner2')

Set inner1 to false

What is Expected?

The screen will show "Inner2"

What is actually happening?

The screen continues to show "Inner1"

@yyx990803
Copy link
Member

Ideally you should depend on the condition in the children thunk itself: https://jsfiddle.net/rpmce1v8/1/

The current behavior can be confusing though, I'll see how we can improve that.

@blocka
Copy link
Author

blocka commented Aug 4, 2016

In particular use case, I have a HOC component which is rendering a component in a layout component. I did some experimenting, and it seems the issues only happens if the HOC is functional.

Here is the version that works https://jsfiddle.net/gxrx0c3f/ and the version that doesn't https://jsfiddle.net/kxvajwcq/

@yyx990803
Copy link
Member

Fixed in b5b963f and related commits. Note in the next release it is no longer necessary (and nor supported) to pass component children as thunks. Just directly pass children vnodes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants