dioxus icon indicating copy to clipboard operation
dioxus copied to clipboard

Option None Element crash the Renderer on Fullstack Serve direct access

Open gusinacio opened this issue 1 year ago • 1 comments

Problem

When you return a rsx!{} or a None as an Element, the renderer crashes with the following logs:

[INFO] dioxus_fullstack::render - Suspense resolved
thread 'tokio-runtime-worker' panicked at /Users/gustavoinacio/.cargo/git/checkouts/dioxus-5df58c476196bcfb/55d1f83/packages/ssr/src/renderer.rs:129:38:
not yet implemented: generally, scopes should be sync, only if being traversed
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'tokio-runtime-worker' panicked at /Users/gustavoinacio/.cargo/git/checkouts/dioxus-5df58c476196bcfb/55d1f83/packages/fullstack/src/render.rs:97:60:
called `Result::unwrap()` on an `Err` value: RecvError(())

If you access another page, then the page with None element, it renders correctly.

Steps To Reproduce

Steps to reproduce the behavior:

  • Create a component that returns None:
#[component]
pub fn Test() -> Element {
   None // it can be rsx!{}
}
  • Add the element to a page (via Router)
  • Access the page directly

Expected behavior

When accessing a None element, it should not display anything and it should not crash.

Screenshots

If applicable, add screenshots to help explain your problem.

Environment:

  • Dioxus version: master
  • Rust version: 1.77.0
  • OS info: MacOS
  • App platform: web fullstack

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
  • [ ] I don't have time to fix this right now, but maybe later

gusinacio avatar Mar 30 '24 01:03 gusinacio

I just came across the same issue, +1 Except I am on Linux

XavDesbordes avatar Mar 31 '24 18:03 XavDesbordes