Use futures_util mutex instead of flume for sending flush lock wakeups
This commit is contained in:
14 files changed
+100
-43
No files matched your search
+2
-2
@@ -7,7 +7,7 @@ fn main() {
|
||||
|
||||
fn app() -> Element {
|
||||
let mut breed = use_signal(|| "deerhound".to_string());
|
||||
let breed_list = use_async_memo(move || async move {
|
||||
let breed_list = use_resource(move || async move {
|
||||
let list = reqwest::get("https://dog.ceo/api/breeds/list/all")
|
||||
.await
|
||||
.unwrap()
|
||||
@@ -44,7 +44,7 @@ fn app() -> Element {
|
||||
|
||||
#[component]
|
||||
fn BreedPic(breed: Signal<String>) -> Element {
|
||||
let fut = use_async_memo(move || async move {
|
||||
let fut = use_resource(move || async move {
|
||||
reqwest::get(format!("https://dog.ceo/api/breed/{breed}/images/random"))
|
||||
.await
|
||||
.unwrap()
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ fn main() {
|
||||
}
|
||||
|
||||
fn app() -> Element {
|
||||
let future = use_async_memo(move || async move {
|
||||
let future = use_resource(move || async move {
|
||||
let mut eval = eval(
|
||||
r#"
|
||||
dioxus.send("Hi from JS!");
|
||||
|
||||
+3
-6
@@ -21,10 +21,7 @@ fn app() -> Element {
|
||||
if count() > 30 {
|
||||
return rsx! {
|
||||
h1 { "Count is too high!" }
|
||||
button {
|
||||
onclick: move |_| count.set(0),
|
||||
"Press to reset"
|
||||
}
|
||||
button { onclick: move |_| count.set(0), "Press to reset" }
|
||||
};
|
||||
}
|
||||
|
||||
@@ -38,8 +35,8 @@ fn app() -> Element {
|
||||
}
|
||||
});
|
||||
|
||||
// use_resource will spawn a future that resolves to a value - essentially an async memo
|
||||
let _slow_count = use_async_memo(move || async move {
|
||||
// use_resource will spawn a future that resolves to a value
|
||||
let _slow_count = use_resource(move || async move {
|
||||
tokio::time::sleep(Duration::from_millis(200)).await;
|
||||
count() * 2
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user