Subscribe on changes!

v3.2.34-beta.1: regression with v-if and comments

avatar
May 18th 2022

Link to minimal reproduction

https://sfc.vuejs.org/#__DEV__eyJBcHAudnVlIjoiPHNjcmlwdCBzZXR1cD5cbmltcG9ydCB7IHJlZiB9IGZyb20gJ3Z1ZSc7XG5cbmNvbnN0IGVycm9yID0gcmVmKGZhbHNlKTtcbjwvc2NyaXB0PlxuXG48dGVtcGxhdGU+XG4gIDwhLS0gY29tbWVudCAtLT5cbiAgPGRpdj5cbiAgICA8ZGl2IHYtaWY9XCJlcnJvclwiPnYtaWY8L2Rpdj5cbiAgICA8YnV0dG9uIEBjbGljaz1cImVycm9yID0gIWVycm9yXCI+Q2xpY2s8L2J1dHRvbj5cbiAgPC9kaXY+XG48L3RlbXBsYXRlPlxuIiwiaW1wb3J0LW1hcC5qc29uIjoie1xuICBcImltcG9ydHNcIjoge1xuICAgIFwidnVlXCI6IFwiaHR0cHM6Ly91bnBrZy5jb20vQHZ1ZS9ydW50aW1lLWRvbUAzLjIuMzQtYmV0YS4xL2Rpc3QvcnVudGltZS1kb20uZXNtLWJyb3dzZXIuanNcIlxuICB9XG59In0=

Steps to reproduce

Consider a simple v-if in a template with a comment

<script setup>
import { ref } from 'vue';

const error = ref(false);
</script>

<template>
  <!-- comment -->
  <div>
    <div v-if="error">v-if</div>
    <button @click="error = !error">Click</button>
  </div>
</template>

What is expected?

The div is shown when clicking on the button in v3.2.33

What is actually happening?

The div is dnot shown in v3.2.34-beta.1, except if the comment is removed.

System Info

System:
    OS: macOS 12.3.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 32.13 GB / 64.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.15.0 - ~/.volta/tools/image/node/16.15.0/bin/node
    Yarn: 1.22.17 - ~/.volta/tools/image/yarn/1.22.17/bin/yarn
    npm: 8.10.0 - ~/.volta/tools/image/npm/8.10.0/bin/npm
  Browsers:
    Chrome: 101.0.4951.64
    Firefox: 100.0
    Safari: 15.4
  npmPackages:
    vue: 3.2.34-beta.1 => 3.2.34-beta.1

Any additional comments?

No response