@@ -2,6 +2,7 @@ import type { ConfigContext, Layouts } from "@/config";
22import {
33 AppContext ,
44 getGitHubFileUrl ,
5+ mergeLayoutConfigs ,
56 renderPageMeta ,
67 TransformChildren ,
78 TransformChildrenSlot ,
@@ -30,7 +31,7 @@ export interface NotebookLayoutOptions<C extends ConfigContext = ConfigContext>
3031 markdownUrl ?: string ;
3132 lastModified ?: Date | null ;
3233 body ?: ReactNode ;
33- layoutProps ?: TransformChildren < Partial < DocsLayoutProps > > ;
34+ layoutProps ?: Partial < TransformChildren < DocsLayoutProps > > ;
3435 pageProps ?: TransformChildren < DocsPageProps > ;
3536 } > ;
3637}
@@ -83,23 +84,22 @@ export function createNotebookLayout<C extends ConfigContext = ConfigContext>({
8384 if ( ! page ) unstable_notFound ( ) ;
8485
8586 async function getLayoutProps (
86- overrides ?: TransformChildren < Partial < DocsLayoutProps > > ,
87+ overrides ?: Partial < TransformChildren < DocsLayoutProps > > ,
8788 ) : Promise < TransformChildren < DocsLayoutProps > > {
8889 const { name, git } = siteConfig ;
90+ const inherit = await layouts . defaultProps ?. call ( props , page ! ) ;
8991
90- if ( layouts . defaultProps ) {
91- overrides ??= await layouts . defaultProps . call ( props , page ! ) ;
92- }
93-
94- return {
95- tree : source . getPageTree ( lang ) ,
96- githubUrl : git ? `https://github.com/${ git . user } /${ git . repo } ` : undefined ,
97- ...overrides ,
98- nav : {
99- title : name ,
100- ...overrides ?. nav ,
92+ return mergeLayoutConfigs (
93+ {
94+ tree : source . getPageTree ( lang ) ,
95+ githubUrl : git ? `https://github.com/${ git . user } /${ git . repo } ` : undefined ,
96+ nav : {
97+ title : name ,
98+ } ,
10199 } ,
102- } ;
100+ inherit ,
101+ overrides ,
102+ ) ;
103103 }
104104
105105 const _raw = await render ?. call ( props , page ) ;
0 commit comments