Skip to content

[2.0] Transition fails to show with components using render functions #3474

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
mtpc opened this issue Aug 18, 2016 · 4 comments
Closed

[2.0] Transition fails to show with components using render functions #3474

mtpc opened this issue Aug 18, 2016 · 4 comments

Comments

@mtpc
Copy link

mtpc commented Aug 18, 2016

Vue.js version

v2.0.0-rc.2

Reproduction Link

https://jsfiddle.net/wy1frr50/3/

Steps to reproduce

Push the button until it cycles back into "First", then push it again

What is Expected?

A fade transition to "Second"

What is actually happening?

Uncaught TypeError: Cannot read property '_pending' of null
After investigation, it sounds like the element being transitioned out is (logically) removed from the dom, but the old reference is still kept. When vue tries to recycle it for rerendering, the reference lacks a parentNode property, leading to this error.

@mtpc mtpc changed the title [2.0] Transition fail to show with components using render functions [2.0] Transition fails to show with components using render functions Aug 18, 2016
@yyx990803
Copy link
Member

You should not be mutating the vnode's key in mounted - by that time the vnodes have already been rendered into real DOM nodes, mutating them in mounted doesn't do anything.

Instead, do that directly in the render function before returning them: https://jsfiddle.net/80nazax6/

@yyx990803
Copy link
Member

Btw, there's no need for h(Vue.options.components['Transition']) - just h('transition') will do.

And there's also no need for registering Elm and Container and then retrieve them from this.$options.components, just use them directly.

https://jsfiddle.net/80nazax6/1/

@LinusBorg
Copy link
Member

LinusBorg commented Aug 18, 2016

@yyx990803 That does not fix the error described in this issue, unfortunately.

If you click the button in your latest fiddle until "Second" appears for the second(!) time, you will see the error in the console, and clicking the button again won't transition to "third"

@LinusBorg LinusBorg reopened this Aug 18, 2016
@mtpc
Copy link
Author

mtpc commented Aug 18, 2016

Thanks for the advices regarding the unnecessary boilerplate!
Your solution doesn't seem to fix the issue, though, as @LinusBorg mentioned

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

3 participants