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

Create a component like KeepAlive. #4012

Closed
hezhongfeng opened this issue Jun 28, 2021 · 2 comments
Closed

Create a component like KeepAlive. #4012

hezhongfeng opened this issue Jun 28, 2021 · 2 comments

Comments

@hezhongfeng
Copy link

Version

3.1.2

Reproduction link

https://github.com/hezhongfeng/vue-page-stack/tree/next

Steps to reproduce

I don't like Vue's KeepAlive cache policy , So I want to create a component like KeepAlive.
But When I use my Component with transition,there is a error Uncaught TypeError: Cannot read property '_' of null.
This error is create by packages/runtime-core/src/componentSlots.ts initSlots.
I don't know how to resolve it.

const KKeepAliveImpl: ComponentOptions = {
  name: `KKeepAlive`,
  __isKeepAlive: true,

  setup(props, { slots }: SetupContext) {
    return () => {};
  },
};

const KKeepAlive = KKeepAliveImpl as any as {
  __isKeepAlive: true;
  new (): {
    $props: VNodeProps;
  };
};

What is expected?

Like KeepAlive work.

What is actually happening?

there is a error Uncaught TypeError: Cannot read property '_' of null.

@posva
Copy link
Member

posva commented Jun 28, 2021

Hi, thanks for your interest but Github issues are for bug reports and feature requests only. You can ask questions on the forum, the Discord server or StackOverflow.


You should check this PR and the linked RFC: #3414

@posva posva closed this as completed Jun 28, 2021
@hezhongfeng
Copy link
Author

You have good suggestions.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants