mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-12 23:57:09 +00:00
fix: use shell for SSR, and do not create a second <head>
This commit is contained in:
parent
d0f2069f1c
commit
11f8453f7c
1 changed files with 8 additions and 7 deletions
|
@ -33,11 +33,9 @@ pub fn App() -> impl IntoView {
|
||||||
let (is_routing, set_is_routing) = signal(false);
|
let (is_routing, set_is_routing) = signal(false);
|
||||||
|
|
||||||
view! {
|
view! {
|
||||||
<head>
|
<Stylesheet id="leptos" href="/public/style.css"/>
|
||||||
<Stylesheet id="leptos" href="/public/style.css"/>
|
<Link rel="shortcut icon" type_="image/ico" href="/public/favicon.ico"/>
|
||||||
<Link rel="shortcut icon" type_="image/ico" href="/public/favicon.ico"/>
|
<Meta name="description" content="Leptos implementation of a HackerNews demo."/>
|
||||||
<Meta name="description" content="Leptos implementation of a HackerNews demo."/>
|
|
||||||
</head>
|
|
||||||
<Router set_is_routing>
|
<Router set_is_routing>
|
||||||
// shows a progress bar while async data are loading
|
// shows a progress bar while async data are loading
|
||||||
<div class="routing-progress">
|
<div class="routing-progress">
|
||||||
|
@ -66,7 +64,7 @@ pub fn hydrate() {
|
||||||
|
|
||||||
#[cfg(feature = "ssr")]
|
#[cfg(feature = "ssr")]
|
||||||
mod ssr_imports {
|
mod ssr_imports {
|
||||||
use crate::App;
|
use crate::{shell, App};
|
||||||
use axum::{routing::post, Router};
|
use axum::{routing::post, Router};
|
||||||
use leptos::prelude::*;
|
use leptos::prelude::*;
|
||||||
use leptos_axum::{generate_route_list, LeptosRoutes};
|
use leptos_axum::{generate_route_list, LeptosRoutes};
|
||||||
|
@ -90,7 +88,10 @@ mod ssr_imports {
|
||||||
|
|
||||||
// build our application with a route
|
// build our application with a route
|
||||||
let app: axum::Router<()> = Router::new()
|
let app: axum::Router<()> = Router::new()
|
||||||
.leptos_routes(&leptos_options, routes, App)
|
.leptos_routes(&leptos_options, routes, {
|
||||||
|
let options = leptos_options.clone();
|
||||||
|
move || shell(options.clone())
|
||||||
|
})
|
||||||
.route("/api/*fn_name", post(leptos_axum::handle_server_fns))
|
.route("/api/*fn_name", post(leptos_axum::handle_server_fns))
|
||||||
.with_state(leptos_options);
|
.with_state(leptos_options);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue