-
Notifications
You must be signed in to change notification settings - Fork 257
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: Stub instance of the same component #1979
fix: Stub instance of the same component #1979
Conversation
✅ Deploy Preview for vue-test-utils-docs ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Thank you @freakzlike, I'll go ahead and test this across real codebase right today :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking a stab at this @freakzlike
Code looks good, even if I agree it's hard to understand all the negations of negations
export const addToDoNotStubComponents = ( | ||
type: ConcreteComponent, | ||
onlyRoot?: boolean | ||
) => doNotStubComponents.set(type, !!onlyRoot) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we could have two distinct functions, with different names to make it easier to understand?
like addToDoNotStubComponentsButOnlyInRoot
? (I admit it's not a great name ^^)
I'm iterating on this one, and while I'm working on suggestion, would like to share my thoughts:
|
You are right. It's only used for the root components and it might be a better way |
I tried to retrieve or check for the root component without the need of |
Need a rebase, since we just released the Glad @xanf is running this on a real code base - will wait back to hear from him before merging this one up. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This needs to be rebased, as some logic moved to src/createInstance
now that renderToString
landed (sorry)
# Conflicts: # src/mount.ts
Shall we merge or did we want more testing from @xanf? Happy to move forward as-is. |
@freakzlike @lmiller1990 I'm going to finish testing no later than tomorrow, sorry for delay - our codebase uses v-once, and I need to use vuejs with this PR vuejs/core#7730 merged to test it, cause compiler blows up |
I think we should merge and release this one. I'll give it another 24h then ship. |
Fixes #1162
I'm not really happy with the wording, because there is a lot of double negation. However, the code does the job