Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions examples/01-app-demos/hotdog/src/frontend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{

#[component]
pub fn Favorites() -> Element {
let mut favorites = use_loader(list_dogs)?;
let favorites = use_loader(list_dogs)?;

rsx! {
div { id: "favorites",
Expand Down Expand Up @@ -41,7 +41,7 @@ pub fn NavBar() -> Element {

#[component]
pub fn DogView() -> Element {
let mut img_src = use_loader(|| async move {
let img_src = use_loader(|| async move {
anyhow::Ok(
reqwest::get("https://dog.ceo/api/breeds/image/random")
.await?
Expand Down
22 changes: 11 additions & 11 deletions examples/01-app-demos/weather_app.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(non_snake_case)]

use dioxus::{fullstack::Loading, prelude::*};
use dioxus::prelude::*;
use serde::{Deserialize, Serialize};
use std::fmt::Display;

Expand Down Expand Up @@ -36,17 +36,17 @@ fn app() -> Element {
}
Forecast { weather: weather.cloned() }
div { height: "20px", margin_top: "10px",
if weather.loading() {
if weather.running() {
"Fetching weather data..."
}
}
},
Err(Loading::Pending(_)) => rsx! {
Err(RenderError::Error(_)) => rsx! {
div { "Failed to load weather data." }
},
Err(RenderError::Suspended(_)) => rsx! {
div { "Loading weather data..." }
},
Err(Loading::Failed(_)) => rsx! {
div { "Failed to load weather data." }
}
}
}
}
Expand Down Expand Up @@ -162,16 +162,16 @@ fn SearchBox(mut country: WriteSignal<WeatherLocation>) -> Element {
}
}
},
Err(Loading::Pending(_)) => rsx! {
Err(RenderError::Error(error)) => rsx! {
li { class: "pl-8 pr-2 py-1 border-b-2 border-gray-100 relative",
"Searching..."
"Failed to search: {error:?}"
}
},
Err(Loading::Failed(handle)) => rsx! {
Err(RenderError::Suspended(_)) => rsx! {
li { class: "pl-8 pr-2 py-1 border-b-2 border-gray-100 relative",
"Failed to search: {handle.error():?}"
"Searching..."
}
}
},
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/05-using-async/suspense.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn Doggo() -> Element {
//
// During SSR, `use_loader` will serialize the contents of the fetch, and during hydration, the client will
// use the pre-fetched data instead of re-fetching to render.
let mut dog = use_loader(move || async move {
let dog = use_loader(move || async move {
#[derive(serde::Deserialize, serde::Serialize, PartialEq)]
struct DogApi {
message: String,
Expand Down
2 changes: 1 addition & 1 deletion examples/08-apis/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fn app() -> Element {
res
});

match future.value().as_ref() {
match future.as_ref() {
Some(v) => rsx!( p { "{v}" } ),
_ => rsx!( p { "waiting.." } ),
}
Expand Down
1 change: 1 addition & 0 deletions packages/fullstack-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ inventory = { workspace = true }
serde_json = { workspace = true }
generational-box = { workspace = true }
futures-util = { workspace = true, features = ["std"] }
dioxus-stores.workspace = true

[features]
web = []
Expand Down
Loading