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

Compiler crash on v-if on svg or template #724

Closed
jods4 opened this issue Feb 14, 2020 · 4 comments
Closed

Compiler crash on v-if on svg or template #724

jods4 opened this issue Feb 14, 2020 · 4 comments

Comments

@jods4
Copy link
Contributor

jods4 commented Feb 14, 2020

Version

3.0.0-alpha.4

Reproduction link

http://none.sorry

Steps to reproduce

I'm very sorry that I have not managed to create a short repro to share yet but I think this may be valuable.

When I'm trying to compile the following template, the compiler crashes:

<template>
  <nav>
    <div class='nav-top'>
      <div v-for='n of stack' :key='n.label' @click='go(n.group)' class='nav-item nav-parent'>{{ n.label }}</div>
    </div>
    <div v-for='n of nav' :key='n.label' @click='go(n)' :class='n.to ? "nav-item" : "nav-item nav-group"'
         style='display: flex'>
      <span style='flex: 1'>{{ n.label }}</span>
      <svg style='width: 1em; height: 1em; fill: currentcolor' v-if='n.to'>
        <use href='#down'></use>
      </svg>
    </div>
  </nav>
</template>

I have identified that the trigger for the bug is the v-if on <svg>. It also crashes if I put it on a template around the svg but it doesn't crash if I put it on a wrapping <div>.

What is expected?

No crash

What is actually happening?

Stack trace:

ERROR in ./ClientApp/navigation.vue?vue&type=template&id=75bc159b (./node_modules/vue-loader/dist/templateLoader.js??ref--5!./node_modules/vue-loader/dist??ref--10-0!./ClientApp/navigation.vue?vue&type=template&id=75bc159b)
Module build failed (from ./node_modules/vue-loader/dist/templateLoader.js):
TypeError: Cannot read property '1' of undefined
    at injectProp (g:\proj\renault\portal\Src\Portal\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:479:83)
    at createChildrenCodegenNode (g:\proj\renault\portal\Src\Portal\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:2633:9)
    at createCodegenNodeForBranch (g:\proj\renault\portal\Src\Portal\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:2588:62)
    at Array.siblings (g:\proj\renault\portal\Src\Portal\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:2528:42)
    at traverseNode (g:\proj\renault\portal\Src\Portal\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:1734:19)
    at traverseChildren (g:\proj\renault\portal\Src\Portal\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:1683:9)
    at traverseNode (g:\proj\renault\portal\Src\Portal\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:1728:13)
    at traverseChildren (g:\proj\renault\portal\Src\Portal\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:1683:9)
    at traverseNode (g:\proj\renault\portal\Src\Portal\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:1728:13)
    at traverseChildren (g:\proj\renault\portal\Src\Portal\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:1683:9)
    at traverseNode (g:\proj\renault\portal\Src\Portal\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:1728:13)
    at traverseChildren (g:\proj\renault\portal\Src\Portal\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:1683:9)
    at traverseNode (g:\proj\renault\portal\Src\Portal\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:1728:13)
    at transform (g:\proj\renault\portal\Src\Portal\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:1617:5)
    at Object.baseCompile (g:\proj\renault\portal\Src\Portal\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:3783:5)
    at Object.compile (g:\proj\renault\portal\Src\Portal\node_modules\@vue\compiler-dom\dist\compiler-dom.cjs.js:2602:25)
 @ ./ClientApp/navigation.vue?vue&type=template&id=75bc159b 1:0-174 1:0-174
 @ ./ClientApp/navigation.vue
 @ ./node_modules/ts-loader??ref--1!./node_modules/vue-loader/dist??ref--10-0!./ClientApp/app.vue?vue&type=script&lang=ts
 @ ./ClientApp/app.vue?vue&type=script&lang=ts
 @ ./ClientApp/app.vue
 @ ./ClientApp/main.ts
@posva
Copy link
Member

posva commented Feb 14, 2020

Have you tried using the current master version? It seems to work using the template explorer

@jods4
Copy link
Contributor Author

jods4 commented Feb 14, 2020

This was alpha.4.
I tried to create a repro on the template explorer but I noticed it worked... that's why I couldn't put up a repro quickly.

I was in a hurry to leave work, I can try master this week-end or Monday to confirm if the bug is still there. If you can publish an alpha.5 it might even be better.

@yyx990803
Copy link
Member

Closing since I can confirm this is fixed in current master. Will be releasing alpha.5 soon.

@jods4
Copy link
Contributor Author

jods4 commented Feb 14, 2020

If template explorer is based on master, that would explain why I couldn't reproduce it then.
I just made a quick test and just having a plain <svg v-if='x'></svg> is a repro with alpha.4.

@github-actions github-actions bot locked and limited conversation to collaborators Nov 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants