Remember all the files

This commit is contained in:
benwis 2023-01-18 23:21:08 -08:00
parent 452e397048
commit ac343427e7
4 changed files with 9 additions and 14 deletions

View file

@ -33,22 +33,13 @@ sqlx = { version = "0.6.2", features = [
"runtime-tokio-rustls",
"sqlite",
], optional = true }
thiserror = "1.0.38"
[features]
default = ["csr"]
csr = ["leptos/csr", "leptos_meta/csr", "leptos_router/csr"]
hydrate = ["leptos/hydrate", "leptos_meta/hydrate", "leptos_router/hydrate"]
ssr = [
"dep:axum",
"dep:tower",
"dep:tower-http",
"dep:tokio",
"dep:sqlx",
"leptos/ssr",
"leptos_meta/ssr",
"leptos_router/ssr",
"leptos_axum",
]
ssr = ["dep:axum", "dep:tower", "dep:tower-http", "dep:tokio", "dep:sqlx", "leptos/ssr", "leptos_meta/ssr", "leptos_router/ssr", "leptos_axum"]
[package.metadata.cargo-all-features]
denylist = [
@ -103,4 +94,4 @@ lib-features = ["hydrate"]
# If the --no-default-features flag should be used when compiling the lib target
#
# Optional. Defaults to false.
lib-default-features = false
lib-default-features = false

View file

@ -13,7 +13,7 @@ if #[cfg(feature = "ssr")] {
use tower_http::services::ServeDir;
use std::sync::Arc;
use leptos::{LeptosOptions, view};
use crate::todo::{ErrorBoundary, ErrorBoundaryProps};
use crate::todo::{ErrorComponent, ErrorComponentProps};
pub async fn file_and_error_handler(uri: Uri, Extension(options): Extension<Arc<LeptosOptions>>, req: Request<Body>) -> AxumResponse {
let options = &*options;
@ -23,7 +23,7 @@ if #[cfg(feature = "ssr")] {
if res.status() == StatusCode::OK {
res.into_response()
} else{
let handler = leptos_axum::render_app_to_stream(options.to_owned(), |cx| view! { cx, <ErrorBoundary/> });
let handler = leptos_axum::render_app_to_stream(options.to_owned(), |cx| view! { cx, <ErrorComponent/> });
handler(req).await.into_response()
}
}

View file

@ -1,5 +1,6 @@
use cfg_if::cfg_if;
use leptos::*;
pub mod error;
pub mod file;
pub mod todo;

View file

@ -160,7 +160,10 @@ pub fn Todos(cx: Scope) -> impl IntoView {
</label>
<input type="submit" value="Add"/>
</MultiActionForm>
<ErrorBoundary fallback=|cx| view! { cx, "Nested Error" }.into_view(cx)>
<ErrorComponent/>
</ErrorBoundary>
<Transition fallback=move || view! {cx, <p>"Loading..."</p> }>
{move || {
let existing_todos = {