Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Bug: KeepAlive usage will give a "Non-function value encountered for default slot" warning #1888

@laddi-netapp

Description

@laddi-netapp

Describe the bug
It's really simple, any component that uses <keep-alive> around dynamic components will trigger this warning:

[Vue warn]: Non-function value encountered for default slot. Prefer function slots for better performance.
  at <KeepAlive>

To Reproduce
Create a component that has dynamic components surrounded by <keep-alive>. Add any test for it and observe the warning during shallowMount rendering. Warning goes away as soon as the <keep-alive> tags are removed or using full mount.

Expected behavior
Would expect this to behave exactly the same as Teleport, i.e. no warning shown in the console and being able to globally mock KeepAlive in a similar way.

Related information:

  • @vue/test-utils version: 2.2.3
  • Vue version: 3.2.44
  • node version: 18.12.1
  • yarn version: 1.22.19

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions