repl icon indicating copy to clipboard operation
repl copied to clipboard

playground hangs indefinitely with keep-alive and missing adjecent v-if combination

Open lidlanca opened this issue 3 years ago • 2 comments

replace template with this code in the sfc playground.

<template>
  <keep-alive>
    <A  v-if="1" ></A>
    break
    <A v-else></A>
  </keep-alive>    
</template>

this combination should trigger 2 errors Vue template compilation error: <KeepAlive> expects exactly one child component.(45) Vue template compilation error: v-else/v-else-if has no adjacent v-if or v-else-if.(30)

but instead it causes infinite loop

severity: annoyance, edge case

lidlanca avatar Mar 20 '22 08:03 lidlanca

Hello, First of all this is the place to solve the problem of @vue/repl, your problem is not about repl. Then you're not familiar with keep-alive. the right way: <keep-alive include="a,b"> <component :is="view"></component> </keep-alive> or <keep-alive> <router-view v-if="$route.meta.keepAlive"></router-view> </keep-alive> Thanks.

linpeng118 avatar Mar 24 '22 07:03 linpeng118

The repro has an intentional "bad" code. To trigger the playground freeze.

Same code should show errors in regular vue build

lidlanca avatar Mar 24 '22 08:03 lidlanca