Files
dioxus/packages/core/tests/bubble_error.rs
T
Jani MustonenandJani Mustonen 31f8bab20d Add ScopeId::ROOT (#1398)
* add ScopeId::ROOT

* replace ScopeId(0) with ScopeId::ROOT

---------

Co-authored-by: Jani Mustonen <jani.mustonen@taitounited.fi>
2023-08-25 08:31:23 -05:00

31 lines
562 B
Rust

//! we should properly bubble up errors from components
use dioxus::prelude::*;
fn app(cx: Scope) -> Element {
let raw = match cx.generation() % 2 {
0 => "123.123",
1 => "123.123.123",
_ => unreachable!(),
};
let value = raw.parse::<f32>().unwrap_or(123.123);
cx.render(rsx! {
div { "hello {value}" }
})
}
#[test]
fn bubbles_error() {
let mut dom = VirtualDom::new(app);
{
let _edits = dom.rebuild().santize();
}
dom.mark_dirty(ScopeId::ROOT);
_ = dom.render_immediate();
}