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

fix(stubs): teleport stub children as a function #1833

Merged

Conversation

cexbrayat
Copy link
Member

Fixes #1829

I'm not super convinced by this fix, but it indeed looks like @freakzlike intuition is right: we need to return the children as a function for Teleport to avoid the warning.

Maybe @xanf you have a better idea on how to handle that?

@cexbrayat cexbrayat requested a review from xanf Oct 26, 2022
@netlify
Copy link

netlify bot commented Oct 26, 2022

Deploy Preview for vue-test-utils-docs ready!

Name Link
🔨 Latest commit 60268e6
🔍 Latest deploy log https://app.netlify.com/sites/vue-test-utils-docs/deploys/635a870bdabf1f0008818af0
😎 Deploy Preview https://deploy-preview-1833--vue-test-utils-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Collaborator

@freakzlike freakzlike left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no better solution for this.
Can you add a spy on console.warn on one of the teleport tests?

src/vnodeTransformers/util.ts Outdated Show resolved Hide resolved
src/vnodeTransformers/util.ts Show resolved Hide resolved
@cexbrayat cexbrayat force-pushed the fix/1829-teleport-children-as-a-function branch from 4bb8fd8 to 250610c Compare Oct 27, 2022
@cexbrayat
Copy link
Member Author

@freakzlike I added a test to check that the warning is not logged anymore, and added a check in other tests when it is logged, but when that we expect it.

Maybe we should do the same for the warnings logged by vue compact (either mock them or fix them if needed) to avoid polluting the test logs, and missing a regression like this one in the future

Anyway, this should fix the issue, unless someone comes up with a better idea. I'll let you give a last check and merge

@cexbrayat cexbrayat requested a review from freakzlike Oct 27, 2022
@cexbrayat cexbrayat force-pushed the fix/1829-teleport-children-as-a-function branch from 250610c to 60268e6 Compare Oct 27, 2022
@lmiller1990
Copy link
Member

lmiller1990 commented Oct 27, 2022

This does feel like a bit of a hack, but okay for now. I am not sure of a better way.

Warnings are not much fun. let's merge this up with one more and release.

@lmiller1990 lmiller1990 self-requested a review Oct 27, 2022
@cexbrayat cexbrayat merged commit 13c5e39 into vuejs:main Oct 27, 2022
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: [Vue warn] Non-function value encountered for default slot on stubbed teleport
3 participants