diff --git a/crates/axum_bundler/src/bundle.rs b/crates/axum_bundler/src/bundle.rs index 13365f7d..e2821ba3 100644 --- a/crates/axum_bundler/src/bundle.rs +++ b/crates/axum_bundler/src/bundle.rs @@ -22,8 +22,6 @@ use axum::{routing::get, Router}; use tower_http::services::ServeDir; use tuono_lib::{ssr, Ssr}; -const MODE: &'static = "prod"; - // MODULE_IMPORTS #[tokio::main] diff --git a/packages/tuono-router/src/components/RouteMatch.tsx b/packages/tuono-router/src/components/RouteMatch.tsx index c4c4398b..1fda3921 100644 --- a/packages/tuono-router/src/components/RouteMatch.tsx +++ b/packages/tuono-router/src/components/RouteMatch.tsx @@ -21,6 +21,8 @@ export const RouteMatch = ({ if (!route.isRoot) { return route.options.getParentRoute().component({ children: route.options.component({ data, isLoading }), + data, + isLoading, }) } diff --git a/packages/tuono-router/src/hooks/useServerSideProps.tsx b/packages/tuono-router/src/hooks/useServerSideProps.tsx index d57a27cb..486c1289 100644 --- a/packages/tuono-router/src/hooks/useServerSideProps.tsx +++ b/packages/tuono-router/src/hooks/useServerSideProps.tsx @@ -7,6 +7,7 @@ interface UseServerSidePropsReturn { data: any isLoading: boolean } + /* * Use the props provided by the SSR and dehydrate the * props for client side usage. @@ -15,6 +16,7 @@ interface UseServerSidePropsReturn { */ export function useServerSideProps( route: Route, + // User defined props serverSideProps: any, ): UseServerSidePropsReturn { const isFirstRendering = useRef(true) @@ -27,8 +29,8 @@ export function useServerSideProps( !isFirstRendering.current, ) - const [data, setData] = useState( - serverSideProps || window.__TUONO_SSR_PROPS__.props, + const [data, setData] = useState( + serverSideProps ?? window.__TUONO_SSR_PROPS__?.props, ) useEffect(() => {