Queue effects to run after flush_sync
This commit is contained in:
8 files changed
+137
-59
No files matched your search
@@ -6,7 +6,7 @@ fn main() {
|
||||
|
||||
fn app() -> Element {
|
||||
let mut state = use_signal(|| 0);
|
||||
let mut depth = use_signal(|| 1 as usize);
|
||||
let mut depth = use_signal(|| 0 as usize);
|
||||
let mut items = use_memo(move || (0..depth()).map(|f| f as _).collect::<Vec<isize>>());
|
||||
|
||||
let a = use_memo(move || state() + 1);
|
||||
@@ -35,14 +35,14 @@ fn Child(
|
||||
return None;
|
||||
}
|
||||
|
||||
println!("rendering child: {}", depth());
|
||||
|
||||
// These memos don't get re-computed when early returns happen
|
||||
// In dioxus futures spawned with use_future won't progress if they don't get hit during rendering
|
||||
let state = use_memo(move || state() + 1);
|
||||
let item = use_memo(move || items()[dbg!(depth()) - 1]);
|
||||
let item = use_memo(move || items()[depth()]);
|
||||
let depth = use_memo(move || depth() - 1);
|
||||
|
||||
println!("rendering child: {}", depth());
|
||||
|
||||
rsx! {
|
||||
h3 { "Depth({depth})-Item({item}): {state}"}
|
||||
Child {
|
||||
|
||||
Reference in new issue
Block a user