mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-14 00:27:12 +00:00
Remember all the files
This commit is contained in:
parent
452e397048
commit
ac343427e7
4 changed files with 9 additions and 14 deletions
|
@ -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
|
||||||
|
|
|
@ -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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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 = {
|
||||||
|
|
Loading…
Reference in a new issue