-
Notifications
You must be signed in to change notification settings - Fork 264
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: shallow config issue #607
fix: shallow config issue #607
Conversation
@@ -31,9 +36,7 @@ export function mergeGlobalProperties( | |||
mocks: { ...configGlobal.mocks, ...mountGlobal.mocks }, | |||
config: { ...configGlobal.config, ...mountGlobal.config }, | |||
directives: { ...configGlobal.directives, ...mountGlobal.directives }, | |||
renderStubDefaultSlot: !!(mountGlobal.renderStubDefaultSlot !== undefined | |||
? mountGlobal.renderStubDefaultSlot | |||
: configGlobal.renderStubDefaultSlot) |
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.
This library has three points where we can write renderStubDefaultSlot option.
- mount function
- config.global object
- config object
The last one, I wasn't able to find in document, but it exists in GlobalConfigOptions.
So, I fixed code to use one of them (priority: mount -> config -> config.global).
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.
Or if it's for internal, I'll fix my code 🙇🏻
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.
This makes sense, nice job figuring this out.
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 a lot !!
It's an honor to hear you say that. 🙇🏻
|
||
function getSlots(ctx: ComponentPublicInstance): Slots | undefined { | ||
return !config.renderStubDefaultSlot ? undefined : ctx.$slots | ||
renderStubDefaultSlot?: boolean |
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.
In mount.ts, mergedConfig is used like this.
const global = mergeGlobalProperties(config.global, options?.global)
So, I unified using mergetConfig.
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.
Just one comment - can you removed the async
that you added (which is not needed).
Great job figuring out how this works.
@@ -607,7 +607,7 @@ describe('mounting options: stubs', () => { | |||
) | |||
}) | |||
|
|||
it('renders the default slot of deeply nested stubs when renderStubDefaultSlot=true', () => { | |||
it('renders the default slot of deeply nested stubs when renderStubDefaultSlot=true', async () => { |
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.
Not needed.
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.
oh...my gosh... Sorry for my fault. I removed this.
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.
You apologized twice - once in your PR description and once here. No need to do that! You are doing the world a favor with your PR, if anything everyone should be thanking you. 🎉 Thanks a lot!
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.
That's true...!!! Got. Thanks for your kindness 🙇🏻
@@ -31,9 +36,7 @@ export function mergeGlobalProperties( | |||
mocks: { ...configGlobal.mocks, ...mountGlobal.mocks }, | |||
config: { ...configGlobal.config, ...mountGlobal.config }, | |||
directives: { ...configGlobal.directives, ...mountGlobal.directives }, | |||
renderStubDefaultSlot: !!(mountGlobal.renderStubDefaultSlot !== undefined | |||
? mountGlobal.renderStubDefaultSlot | |||
: configGlobal.renderStubDefaultSlot) |
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.
This makes sense, nice job figuring this out.
LGTM, I will do a release in the next few days and this will be included. |
What for ??
I'm sorry to bother you guys 🙇🏻
This pull request is for #606
Why the issue happened.
This caused that issue.
If global.renderStubDefaultSlot is true, options.shallow is ignored.
Hence, the issue caused.