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

Element is removed inside keep-alive #61

Closed
h0rn3z0r opened this issue Jan 11, 2022 · 3 comments
Closed

Element is removed inside keep-alive #61

h0rn3z0r opened this issue Jan 11, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@h0rn3z0r
Copy link
Contributor

h0rn3z0r commented Jan 11, 2022

Demo: https://jsfiddle.net/580kqz4n

<template>
  <fragment>
    <keep-alive>
      <component :is="children[index]"></component>
    </keep-alive>
    
    <button @click="index++">next</button>
  </fragment>
</template>

<script>
const { Fragment } = Frag

export default {
  components: {
    Fragment,
    child1: { template: "<div>child1</div>" },
    child2: { template: "<div>child2</div>" },
    child3: { template: "<div>child3</div>" }
  },
  data() {
    return {
      index: 0,
      children: ["child1", "child2", "child1", "child3", "child1"]
    }
  }
}
</script>

How to reproduce

Click the button 4 times. You should see component names as they are listed in the children array. On the 4th click, instead of child1, nothing is shown. The element is removed from DOM. This does not happen without keep-alive or fragment.

Versions

Vue: 2.6.14
v-frag: 1.4.0

@h0rn3z0r
Copy link
Contributor Author

updated broken demo link

@privatenumber privatenumber added the bug Something isn't working label Mar 24, 2022
@privatenumber
Copy link
Owner

Thanks for the bug report. PR Welcome if you have a fix.

@privatenumber
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants