attempt to render that using the recommend method for pre-rendering:
let mut vdom = VirtualDom::new(PrerenderElement);
let _ = vdom.rebuild();
let output = dioxus_ssr::render(&vdom);
Expected behavior
What should happen, I suspect, is that the rendered element's dangerous_inner_html attribute should be rendered the same as it would if I ran dioxus serve and loaded the page.
What does end up happening is that instead I get a div with the attribute and the raw HTML as text assigned to that attribute.
Environment:
Dioxus version: 0.3.0
Rust version:1.68.2
OS info: Ubuntu 22.04 (Pop_OS! 22.04)
App platform: web / SSR
Questionnaire
[ ] I'm interested in fixing this myself but don't know where to start
[ ] I would like to fix and I have a solution
[x] I don't have time to fix this right now, but maybe later
Note
For my own case, since I'm using Rocket as the backend and am shoving the pre-rendered HTML into a template render that allows escaping HTML, this works just fine. The only change I've had to make is conditional compilation based on whether I'm compiling for target_family = wasm. That way if I'm using Rocket, it will function as it does now and work just fine, and if I'm using dioxus serve it'll conditionally compile a variant that renders it using the dangerous_inner_html attribute.
Problem
When attempting to pre-render using
dioxus_ssr
, having adangerous_inner_html
attribute does not render properly.Steps To Reproduce
Steps to reproduce the behavior:
dangerous_inner_html
attributeExpected behavior
What should happen, I suspect, is that the rendered element's
dangerous_inner_html
attribute should be rendered the same as it would if I randioxus serve
and loaded the page.What does end up happening is that instead I get a
div
with the attribute and the raw HTML as text assigned to that attribute.Environment:
Questionnaire
Note For my own case, since I'm using Rocket as the backend and am shoving the pre-rendered HTML into a template render that allows escaping HTML, this works just fine. The only change I've had to make is conditional compilation based on whether I'm compiling for
target_family = wasm
. That way if I'm using Rocket, it will function as it does now and work just fine, and if I'm usingdioxus serve
it'll conditionally compile a variant that renders it using thedangerous_inner_html
attribute.