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

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

Closed
laddi-netapp opened this issue Nov 28, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@laddi-netapp
Copy link
Contributor

laddi-netapp commented Nov 28, 2022

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
@laddi-netapp laddi-netapp added the bug Something isn't working label Nov 28, 2022
@cexbrayat
Copy link
Member

Hi @laddi-netapp

Thanks for the report. Yeah I gues we need to have the same workaround that I introduced in #1833 for KeepAlive

Would you be interested in trying to open a PR to fix this issue? We would gladly review and merge it.

@laddi-netapp
Copy link
Contributor Author

I'll give it a try, might be fun! 😄

laddi-netapp added a commit to laddi-netapp/test-utils that referenced this issue Nov 28, 2022
@cexbrayat
Copy link
Member

This has been fixed by #1888 and #1889

Thanks @laddi-netapp 👍

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