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

SSR: transition component does not inherit attributes #3981

Closed
dmtkpv opened this issue Jun 20, 2021 · 2 comments
Closed

SSR: transition component does not inherit attributes #3981

dmtkpv opened this issue Jun 20, 2021 · 2 comments
Labels
❗ p4-important Priority 4: this fixes bugs that violate documented behavior, or significantly improves perf. has workaround A workaround has been found to avoid the problem 🐞 bug Something isn't working scope: ssr

Comments

@dmtkpv
Copy link

dmtkpv commented Jun 20, 2021

Version

3.1.1

Steps to reproduce

Run this code

const { createSSRApp } = require('vue')
const { renderToString } = require('@vue/server-renderer')

const app = createSSRApp({
    template: `<test class="test--root" />`
})

app.component('test', {
    props: ['active'],
    template: `
        <transition name="fade">
            <div class="test" v-show="active">Test</div>
        </transition>    
    `
})

renderToString(app).then(html => {
    console.log(html);
})

What is expected?

Output is

<div class="test test--root" style="display:none;">Test</div>

What is actually happening?

Output is

<div class="test" style="display:none;">Test</div>
@posva posva added 🐞 bug Something isn't working ❗ p4-important Priority 4: this fixes bugs that violate documented behavior, or significantly improves perf. scope: ssr has workaround A workaround has been found to avoid the problem labels Jun 21, 2021
@posva
Copy link
Member

posva commented Jun 21, 2021

As a workaround, you can manually inherit the $attrs:

app.component('test', {
    props: ['active'],
    inheritAttrs: false,
    template: `
        <transition name="fade">
            <div v-bind="$attrs" class="test" v-show="active">Test</div>
        </transition>    
    `
})

@edison1105
Copy link
Member

edison1105 commented Jun 21, 2021

@github-actions github-actions bot locked and limited conversation to collaborators Oct 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
❗ p4-important Priority 4: this fixes bugs that violate documented behavior, or significantly improves perf. has workaround A workaround has been found to avoid the problem 🐞 bug Something isn't working scope: ssr
Projects
None yet
Development

No branches or pull requests

3 participants