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

component content unexpectedly rendered #9877

FranckFreiburger opened this Issue Apr 15, 2019 · 2 comments


None yet
2 participants
Copy link

FranckFreiburger commented Apr 15, 2019



Reproduction link

Steps to reproduce

just run the fiddle demo

What is expected?

Since parent component (<foo>) renders nothing,
I expect bar() to not be called.

What is actually happening?

bar() is unexpectedly called

This is a simplified test case.
This situation is much more annoying when using SSR + browser-only-library + vue-no-ssr.
This ends up with JS code designed for client-side to be called server-side despite of using no-ssr mechanism


This comment has been minimized.

Copy link

posva commented Apr 15, 2019

as you are using a regular slot, this one is rendered in the parent template then passed to the component, using a scoped slot would prevent it as it won't be rendered if it isn't used inside the component. Wrapping it in a <template v-slot></template>popp or putting v-slot in the foo component will prevent it from eagerly render.

This probably won't be a problem for v3 though as slots will be unified but not evaluating the content would remove the $slot.default property access, and that would be a breaking change

@posva posva closed this Apr 15, 2019


This comment has been minimized.

Copy link

FranckFreiburger commented Apr 15, 2019

Thank you for this clarification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.