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: shallow config issue #607

Merged
merged 4 commits into from
May 20, 2021

Conversation

YutamaKotaro
Copy link
Contributor

@YutamaKotaro YutamaKotaro commented May 19, 2021

What for ??

I'm sorry to bother you guys 🙇🏻
This pull request is for #606

Why the issue happened.

This caused that issue.

stubComponents(global.stubs, global.renderStubDefaultSlot ? false : options?.shallow )

If global.renderStubDefaultSlot is true, options.shallow is ignored.
Hence, the issue caused.

@@ -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)
Copy link
Contributor Author

@YutamaKotaro YutamaKotaro May 19, 2021

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).

Copy link
Contributor Author

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 🙇🏻

Copy link
Member

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.

Copy link
Contributor Author

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
Copy link
Contributor Author

@YutamaKotaro YutamaKotaro May 19, 2021

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.

@YutamaKotaro YutamaKotaro changed the title Fix/shallow config issue fix: shallow config issue May 19, 2021
Copy link
Member

@lmiller1990 lmiller1990 left a 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 () => {
Copy link
Member

Choose a reason for hiding this comment

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

Not needed.

Copy link
Contributor Author

@YutamaKotaro YutamaKotaro May 20, 2021

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.

Copy link
Member

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!

Copy link
Contributor Author

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)
Copy link
Member

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.

@lmiller1990 lmiller1990 self-requested a review May 20, 2021 04:52
@lmiller1990
Copy link
Member

LGTM, I will do a release in the next few days and this will be included.

@lmiller1990 lmiller1990 merged commit 11b5216 into vuejs:master May 20, 2021
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.

2 participants