Skip to content

<keep-alive> with v-if makes component disappear #220

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

Closed
SilentDepth opened this issue May 10, 2018 · 2 comments
Closed

<keep-alive> with v-if makes component disappear #220

SilentDepth opened this issue May 10, 2018 · 2 comments

Comments

@SilentDepth
Copy link

Demo: https://play.nativescript.org/?template=play-vue&id=liGhQ2

<Page>
  <StackLayout>
    <Button @tap="counter++">{{counter}}</Button>    
    
    <keep-alive>
      <CompButton v-if="isOdd" key="odd" label="Odd"></CompButton> 
      <CompButton v-else key="even" label="Even"></CompButton>
    </keep-alive>
  </StackLayout>
</Page>

<CompButton> is just a simple wrapper of <Button>. This template is almost everything of the app (except a definition of data counter).

The counter starts from 0. When counter <= 2 everything goes fine. But after that, no <CompButton> will be rendered in the view. Everything else functions well, and no <CompButton> is destroyed (means the keep-alive is working).

If replace the custom component with a bare <Button>, no more issues.

@msaelices
Copy link

@rigor789 PR ready for review: #291

I don't know if this PR would cause other issues, but this issue is solved with that.

@nativescript-vue-bot
Copy link
Collaborator

We are locking this issue because it has been closed for more than 14 days.

If the issue comes up again please open a new issue with additional details.

@nativescript-vue nativescript-vue locked as resolved and limited conversation to collaborators Aug 16, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants