TypeError: Cannot read property 'toLowerCase' of undefined at emptyNodeAt
See original GitHub issueVersion
2.5.17
Reproduction link
https://jsfiddle.net/rn58agzj/
Steps to reproduce
I trying to use async components on my site based on nuxt. But I think bug is in Vue. I have a component with multiple subcomponents. I try to import this component asynchronously. Then when a use hard page reloading in a browser (chrome, firefox etc.) there is a chance to this issue appear
What is expected?
There are no errors expected
What is actually happening?
There is an error: TypeError: Cannot read property ‘toLowerCase’ of undefined at emptyNodeAt
The error is emitting from this function that part of Virtual DOM patching algorithm:
function emptyNodeAt (elm) {
return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
}
I can’t reproduct code via jsFiddle. There is a lot of code. There are some code examples in screenshots https://www.dropbox.com/sh/ucon2v5u5dmcag4/AAD_h9Q7ASHUJWsi0_dRORJla?dl=0
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:19 (1 by maintainers)
Top Results From Across the Web
vue.js - Cannot read property 'toLowerCase' of undefined
It may just be that you are not correctly passing the projects data to the projects array. Firstly vue-resource now uses body not...
Read more >Cannot read property 'toLowerCase' of undefined' on new ...
Always getting 'TypeError: Cannot read property 'toLowerCase' of undefined' on new projects, don't fully understand why.
Read more >Cannot read property 'toLowerCase' of undefined-Vue.js
Coding example for the question Javascripts : Cannot read property 'toLowerCase' of undefined-Vue.js.
Read more >Vue.js – Cannot read property 'toLowerCase' of undefined
I am filtering projects with a computed property like this: ... TypeError: Cannot read property 'toLowerCase' of undefined ...
Read more >Cannot Read Property 'Tolowercase' Of Undefined - ADocLib
There is an error: TypeError: Cannot read property 'toLowerCase' of undefined at emptyNodeAt. The error is emitting from this function that part of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Justineo I found the way how this bug happens. If you use async components and one of these components or its child has v-if directive at the top div (or other) element in its template, this bug has a chance to occur. So it is not recommended to use v-if directive at the top element in the component’s template
After days of searching for solutions, I have finally found an answer that has fixed it for my Nuxt project running on version 2.12.0!
@webislife was technically right with the problem being caused by the use of “v-if” in the root of a component or file.
In my project, I had a component imported to the layout and on its tag a “v-if” statement, which was causing the issue. It seems to only occur in SSR or Universal mode, so I just moved my “v-if” statement within the components file under the root.
Anyways, give that a look for anyone currently facing this problem.