-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
getSSRProps return value does not pass down innerHTML as dom props #8112
Comments
I use webpack and have the same problem |
Ah good find, seems like it's intentional indeed! I'll close this one |
I think it needs to be fixed, and this only happens in optimized compilation. For client-compiled render functions it works. core/packages/server-renderer/src/render.ts Line 317 in d2c3d8b
|
This is fixed by 79602f9 However note that the app.directive('inner-html', {
getSSRProps(binding) {
return {
- domProps: {
- innerHTML: 'sanitizeCustom(directiveMeta.value)',
- },
+ innerHTML: sanitizeCustom(binding.value)
};
},
}); Also, |
Vue version
3.2.47
Link to minimal reproduction
https://stackblitz.com/edit/github-c1z4a8-we3axz?file=src/main.ts
Steps to reproduce
return { innerHTML: 'some value' } from a Vue directive via getSSRProps. innerHTML is then not propagated. (see also stackblitz example)
What is expected?
I expect innerHTML to be defined serverside so that my component is prefilled with content before rendering.
What is actually happening?
The innerHTML is not filled, which means the content stays blank (see stackblitz example)
System Info
Any additional comments?
I'm currently working rewriting some parts of our codebase from Nuxt 2 to Nuxt 3. I initially thought this was related to Nuxt but the same issue is happening in Vue 3 with SSR rendering too. I try to modify the innerHTML serverside but it seems that innerHTML is not propagated. I tried in the stackblitz example to write some content to innerHTML via getSSRProps. I'm not sure if this is a bug or intended behaviour, or perhaps there is a different way to modify innerHTML in getSSRProps?
The text was updated successfully, but these errors were encountered: