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

fix(runtime-core): vnode.el is null in watcher after rerendering (fix #2170) #2295

Merged
merged 1 commit into from
Oct 5, 2020
Merged

fix(runtime-core): vnode.el is null in watcher after rerendering (fix #2170) #2295

merged 1 commit into from
Oct 5, 2020

Conversation

kleinfreund
Copy link
Contributor

@kleinfreund kleinfreund commented Oct 3, 2020

An instance’s el property can be null inside a watcher after a component was rerendered (e.g. as a result of a changed prop). In an instance’s update method, the branch for handling mounted instances doesn’t set the el property of what will become the instance’s vnode property early enough. Upon execution of the updateComponentPreRender function, the el property is then null which causes issues in watcher routines that rely on an instance’s $el property.

Fixes #2170.

(I have no knowledge of Vue’s internals besides what I gathered from trying to fix this bug, so the description here and the proposed change might not be adequate.)

An instance’s `el` property can be `null` inside a watcher after a component was rerendered (e.g. as a result of a changed prop). In an instance’s `update` method, the branch for handling mounted instances doesn’t set the `el` property of what will become the instance’s `vnode` property soon enough. Upon processing of the `updateComponentPreRender` function, the `el` property is then `null` which causes issues in watcher routines that rely on an instance’s `$el` property.
@yyx990803 yyx990803 merged commit 28d5fd7 into vuejs:master Oct 5, 2020
@kleinfreund kleinfreund deleted the 2170-fix-vnode-el-being-null-in-watcher-after-rerendering branch October 5, 2020 20:15
unbyte added a commit to unbyte/vue-next that referenced this pull request Oct 6, 2020
yyx990803 pushed a commit that referenced this pull request Oct 13, 2020
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

Successfully merging this pull request may close these issues.

Unhandled error during execution of watcher callback and scheduler flush
2 participants