dioxus icon indicating copy to clipboard operation
dioxus copied to clipboard

render_lazy cant take components

Open saicu opened this issue 3 years ago • 1 comments

dioxus::ssr::render_lazy panics when giving it an empty component, see this small example

#[cfg(test)]
mod tests {
    use dioxus::prelude::*;

    fn TestEl(cx: Scope) -> Element {
        None
    }

    #[test]
    fn it_works() {
        let html = rsx! {
            div {
                TestEl {}
            }
        };

        let result = dioxus::ssr::render_lazy(html);
    }
}

fails with

---- tests::it_works stdout ----
thread 'tests::it_works' panicked at 'called `Option::unwrap()` on a `None` value', /home/sam/.cargo/git/checkouts/dioxus-1e619ce595d3799d/90a3093/packages/ssr/src/lib.rs:276:45
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

saicu avatar Apr 16 '22 21:04 saicu

I am also seeing this behavior on non-empty components.

I have gotten around the issue by rendering VirtualDoms instead https://dioxuslabs.com/reference/platforms/ssr.html

pfesenmeier avatar Jun 07 '22 01:06 pfesenmeier

This is fixed now!

jkelleyrtp avatar Dec 30 '22 08:12 jkelleyrtp