bug: infinite loop async component crashes browser tab
See original GitHub issueVersion
2.6.4
Reproduction link
https://gist.github.com/DominusVilicus/f825d90575fccd6d437b02061c725a91 (code-sandbox doesn’t allow import()
)
Steps to reproduce
export default {
render(h){
return h(import('./comp'))
}
}
Results in an infinite loop that stops the browser tab from working (chrome). Just need to do vue create app
, and create two components, and then use them in the App.vue
export default {
computed:{
component(){
return () => import('./comp')
}
},
render(h){
return h(this.component)
}
}
works fine however
comp.vue
<template>
<pre>Hello World</pre>
</template>
What is expected?
Returning the import
ed component in h(import('./comp'))
should render the async component
What is actually happening?
It’s going in an infinite loop (try put console.log('test')
in render()
Issue Analytics
- State:
- Created 4 years ago
- Comments:16 (5 by maintainers)
Top Results From Across the Web
My browser lags when I try a loop function? - Stack Overflow
You are creating an infinite loop here because of for (let j = 0; j < arr[i].length; j *= product);. Here, j is...
Read more >WPF Hanging in Infinite Rendering Loop - Rick Strahl's Web Log
Ran into a nasty WPF bug this week with Markdown Monster that caused MM to hang during startup in certain scenarios.
Read more >Why doesn't an infinite loop crash the tab like in JavaScript?
In JavaScript, if you use an infinite loop, it crashes the browser (or, if you use Chrome, the tab). Why doesn't it do...
Read more >How to solve the React useEffect Hook's infinite loop patterns
Solve the issue of infinite loops when using the useEffect Hook in React to more smoothly utilize the Hook for your app's side...
Read more >666205 - onblur event is going to infinite loop. - Monorail
We need to know if you will fix this bug or if we need to direct Users to a different browser that doesn't...
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
I already told you that we need a variable in my first comment. I would appreciate if you stop spamming, it’s not the first time you do this and it’s not particularly nice.
If you want to, you can instead try to help improve the documentation page for render functions.
What you can do is this:
and this is the way you do with no modules:
Thanks! Yeah, the doc page for render functions is probably the one that needs the most care among all pages in vuejs docs. It’s also a quite advanced topic so not everybody can contribute to that section, but since you have been experimenting so much with render functions, you should for sure be able to improve that page.
When using a variable like
const Component = () => ...
, Vue stores aresolved
property in itComponent.resolved === true
(after resolving the promise)