From e2b8fee035941cea0b04ab8c500ae55b010c2686 Mon Sep 17 00:00:00 2001 From: Mikhail Tsipotan Date: Tue, 14 Nov 2023 19:25:44 +0300 Subject: [PATCH] fix: scrollToTop typedoc --- src/client/stream.tsx | 6 +++++- src/components/routes.tsx | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/client/stream.tsx b/src/client/stream.tsx index 05109d4..1eeae9b 100644 --- a/src/client/stream.tsx +++ b/src/client/stream.tsx @@ -10,6 +10,10 @@ import {Document as BaseDocument} from '../components/document' /** Hydrate from stream options */ export interface HydrateFromStreamOptions extends RenderOptions { + /** + * Whether to scroll to top on page transitions + * defaults to true + */ scrollToTop?: boolean } @@ -31,7 +35,7 @@ export const hydrateFromStream = async ( routes, Layout = BaseLayout, Document = BaseDocument, - scrollToTop, + scrollToTop = true, ...rest } = options diff --git a/src/components/routes.tsx b/src/components/routes.tsx index 0e6d8a4..d5a3f0b 100644 --- a/src/components/routes.tsx +++ b/src/components/routes.tsx @@ -17,7 +17,7 @@ export interface RoutesProps { } /** Routing component with initial and meta data */ -export const Routes: React.FC = ({routes, scrollToTop = true}) => { +export const Routes: React.FC = ({routes, scrollToTop}) => { const location = useLocation() const navigate = useNavigate()