Skip to content

Repeated v-if change causes slot to disappear #1708

@gitFoxCode

Description

@gitFoxCode

Environment


  • Operating System: Linux
  • Node Version: v16.12.0
  • Nuxt Version: 3.0.0-rc.11
  • Nitro Version: 0.5.4
  • Package Manager: [email protected]
  • Builder: vite
  • User Config: alias, content, nitro, modules, extends, github, colorMode, runtimeConfig
  • Runtime Modules: @nuxtjs/[email protected]
  • Build Modules: -

Reproduction

  1. Create index.md file
  2. Create components/content/Something.vue
  3. Run app, while:

index.md:

::something
#truevar
This is true! Hello!
#falsevar
This is false! :(

Something.vue:

<template>
    <div v-if="test">
        <slot name="truevar"></slot>
    </div>
    <div v-if="!test">
        <slot name="falsevar"></slot>
    </div> 
</template>

<script setup>
const test = ref(true)

setInterval(()=>{
    test.value = !test.value
}, 1000)
</script>

In the real world, of course, I use useState instead of setInterval, but the action is the same.

Describe the bug

When there is a component in a file, e.g. .md, which has component with a v-if and this v-if changes its state frequently then <slot> disappears.

Additional context

No response

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions