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

Hoisting-up vnode - infinite loop warning #6610

Closed
privatenumber opened this issue Sep 15, 2017 · 3 comments
Closed

Hoisting-up vnode - infinite loop warning #6610

privatenumber opened this issue Sep 15, 2017 · 3 comments

Comments

@privatenumber
Copy link
Contributor

@privatenumber privatenumber commented Sep 15, 2017

Version

2.4.4

Reproduction link

http://jsfiddle.net/vjvMp/2019/

Steps to reproduce

The precise layout of the components are in the JSFiddle. The assembly of the components is for some reason very fragile which makes me think that this is a bug. For example, if I remove the top-most layout component that shouldn't affect the code, the warning disappears: http://jsfiddle.net/vjvMp/2020/

What is expected?

For the slot on the Child to be hoisted up to the Parent and rendered above the Child without problem.

What is actually happening?

The Child gets rendered but there is an infinite update loop warning.

@privatenumber
Copy link
Contributor Author

@privatenumber privatenumber commented Sep 15, 2017

The code was working at v2.4.2; seems like it was introduced at v2.4.3.

@yyx990803
Copy link
Member

@yyx990803 yyx990803 commented Sep 15, 2017

  • You are returning API from data, this makes the while api object reactive
  • When you set the vnodes into the API that makes Vue attempt to convert the vnode
  • In 2.4.3 slot nodes are now deep-cloned on re-render to fix some bugs, this makes the render function register the entire vnode to be reactive dependency, so mutating the vnode triggers a re-render.

For now your workaround could be either Object.freeze the vnode or do not make the api injection reactive.

@yyx990803 yyx990803 closed this in 4459b87 Sep 15, 2017
@privatenumber
Copy link
Contributor Author

@privatenumber privatenumber commented Sep 15, 2017

Fix works great! Thanks @yyx990803

ztlevi added a commit to ztlevi/vue that referenced this issue Feb 14, 2018
f2009 pushed a commit to f2009/vue that referenced this issue Jan 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants