Fix generational box in release mode

This commit is contained in:
Jonathan Kelley committed 2024-01-21 12:46:19 -08:00
1 parent 06d9b575b7
commit 028f499bf6
10 files changed
+182 -34

No files matched your search

+1 -1
View File
@@ -29,7 +29,7 @@ fn app() -> Element {
}
#[component]
fn Child(i: usize, counters: Signal<Vec<i32>>) -> Element {
fn Child(counters: Signal<Vec<i32>>, i: usize) -> Element {
rsx! {
li {
button { onclick: move |_| counters.write()[i] -= 1, "-1" }
+9 -9
View File
@@ -36,21 +36,21 @@ struct Client {
#[derive(Routable, Clone)]
enum Route {
#[route("/")]
ClientList {},
ClientList,
#[route("/new")]
ClientAdd {},
ClientAdd,
#[route("/settings")]
Settings {},
Settings,
}
#[component]
fn ClientList() -> Element {
rsx! {
h2 { "List of Clients" }
Link { to: Route::ClientAdd {}, class: "pure-button pure-button-primary", "Add Client" }
Link { to: Route::Settings {}, class: "pure-button", "Settings" }
Link { to: Route::ClientAdd, class: "pure-button pure-button-primary", "Add Client" }
Link { to: Route::Settings, class: "pure-button", "Settings" }
for client in CLIENTS.read().iter() {
div { class: "client", style: "margin-bottom: 50px",
p { "Name: {client.first_name} {client.last_name}" }
@@ -75,7 +75,7 @@ fn ClientAdd() -> Element {
});
// And then navigate back to the client list
dioxus::router::router().push(Route::ClientList {});
dioxus::router::router().push(Route::ClientList);
};
rsx! {
@@ -121,7 +121,7 @@ fn ClientAdd() -> Element {
div { class: "pure-controls",
button { r#type: "submit", class: "pure-button pure-button-primary", "Save" }
Link { to: Route::ClientList {}, class: "pure-button pure-button-primary red", "Cancel" }
Link { to: Route::ClientList, class: "pure-button pure-button-primary red", "Cancel" }
}
}
}
@@ -136,10 +136,10 @@ fn Settings() -> Element {
class: "pure-button pure-button-primary red",
onclick: move |_| {
CLIENTS.write().clear();
dioxus::router::router().push(Route::ClientList {});
dioxus::router::router().push(Route::ClientList);
},
"Remove all Clients"
}
Link { to: Route::ClientList {}, class: "pure-button", "Go back" }
Link { to: Route::ClientList, class: "pure-button", "Go back" }
}
}
+2 -2
View File
@@ -7,7 +7,7 @@ fn main() {
fn app() -> Element {
let mut breed = use_signal(|| "deerhound".to_string());
let mut breed_list = use_future(|| async move {
let breed_list = use_resource(|| 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_future(|| async move {
let fut = use_resource(|| async move {
reqwest::get(format!("https://dog.ceo/api/breed/{breed}/images/random"))
.await
.unwrap()