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", "runtime-tokio-rustls",
"sqlite", "sqlite",
], optional = true } ], optional = true }
thiserror = "1.0.38"
[features] [features]
default = ["csr"] default = ["csr"]
csr = ["leptos/csr", "leptos_meta/csr", "leptos_router/csr"] csr = ["leptos/csr", "leptos_meta/csr", "leptos_router/csr"]
hydrate = ["leptos/hydrate", "leptos_meta/hydrate", "leptos_router/hydrate"] hydrate = ["leptos/hydrate", "leptos_meta/hydrate", "leptos_router/hydrate"]
ssr = [ ssr = ["dep:axum", "dep:tower", "dep:tower-http", "dep:tokio", "dep:sqlx", "leptos/ssr", "leptos_meta/ssr", "leptos_router/ssr", "leptos_axum"]
"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] [package.metadata.cargo-all-features]
denylist = [ denylist = [
@ -103,4 +94,4 @@ lib-features = ["hydrate"]
# If the --no-default-features flag should be used when compiling the lib target # If the --no-default-features flag should be used when compiling the lib target
# #
# Optional. Defaults to false. # 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 tower_http::services::ServeDir;
use std::sync::Arc; use std::sync::Arc;
use leptos::{LeptosOptions, view}; 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 { pub async fn file_and_error_handler(uri: Uri, Extension(options): Extension<Arc<LeptosOptions>>, req: Request<Body>) -> AxumResponse {
let options = &*options; let options = &*options;
@ -23,7 +23,7 @@ if #[cfg(feature = "ssr")] {
if res.status() == StatusCode::OK { if res.status() == StatusCode::OK {
res.into_response() res.into_response()
} else{ } 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() handler(req).await.into_response()
} }
} }

View file

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

View file

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