question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Directives are not passed down to functional components with a template

See original GitHub issue

Version

15.4.0

Reproduction link

https://codesandbox.io/s/7yxprmx12j

Steps to reproduce

  • A component with <template functional>
  • A parent component including the previous component with v-show=“false” directive

What is expected?

Expected to hide the child component

What is actually happening?

The child component is still shown, no CSS style added on the component


I’m posting on vue-loader specifically because of this issue: https://github.com/vuejs/vue/issues/8261

Thanks for your work 😃

Sidenote: a raw tag in a field of this bug report page (<xxx>), without using backquotes, breaks the preview.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:21
  • Comments:15 (1 by maintainers)

github_iconTop GitHub Comments

8reactions
econiccommented, Oct 2, 2019

This bug is almost a year old and there’s not even an official comment.

It requires me to write simple things

<ListItem>
	<SomeComponent #icon />
	<OtherComponent #head />
	<ThirdComponent #footer />
</ListItem>

totally bloated

<ListItem>
	<template #icon>
		<SomeComponent />
	</template>
	<template #head>
		<OtherComponent />
	</template>
	<template #footer>
		<ThirdComponent />
	</template>
</ListItem>

Because otherwise if in the future someone will rewrite SomeComponent, OtherComponent or ThirdComponent into a functional component, he will inevitably break this code. Without even knowing.

Also i can’t add tooltips and other stuff that builds on top of directives to functional components 🤦‍♂ Could at least some core member please comment on this. Is it just not going to happen? Is it possible but i’d have to write a PR? Is there some kind of bigger issue to this?

3reactions
emilianodelvallecommented, Sep 3, 2019

I have the same issue. It seems like a big issue if you have a big app…

Read more comments on GitHub >

github_iconTop Results From Across the Web

What are the benefits of a directive template function in ...
directive ('myDirective', function(){ return { // Compile function acts on template DOM // This happens before it is bound to the scope, so...
Read more >
Functional Components breaking - Vue 3 Migration Guide
The main differences are that: functional attribute removed on <template>; listeners are now passed as part of $attrs and can be ...
Read more >
React Function Components
Essentially props in React are always passed down the component tree: import React from 'react';. function App() {.
Read more >
Blade Templates - The PHP Framework For Web Artisans
Rendering Components; Passing Data To Components; Component Attributes ... Blade does not restrict you from using plain PHP code in your templates.
Read more >
React for Vue developers - Sebastian De Deyne
However, we'll pass down a function instead of declaring a template. <!-- CurrentUser.vue --> <template> <span> <slot :user="user" /> </span> ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found