@@ -14,12 +14,14 @@ function useNavbarItems() {
1414 return useThemeConfig ( ) . navbar . items ;
1515}
1616function NavbarItems ( { items } ) {
17- const unofficial_domain_items = [ ] ;
17+ let unofficial_domain_item ;
1818 const { is_official_domain } = useOfficialContentsContext ( ) ;
1919
2020 for ( const value of Object . values ( items ) ) {
21- if ( value . label === 'Documentation' || value . position === 'right' ) {
22- unofficial_domain_items . push ( value ) ;
21+ console . log ( value ) ;
22+ if ( value . label === 'Documentation' ) {
23+ unofficial_domain_item = value ;
24+ break ;
2325 }
2426 }
2527
@@ -45,21 +47,19 @@ function NavbarItems({ items }) {
4547 </ React . Fragment >
4648 ) : (
4749 < React . Fragment >
48- { unofficial_domain_items . map ( ( unofficial_item , i ) => (
49- < ErrorCauseBoundary
50- key = { i }
51- onError = { ( error ) =>
52- new Error (
53- `A theme navbar item failed to render.
54- Please double-check the following navbar item (themeConfig.navbar.items) of your Docusaurus config:
55- ${ JSON . stringify ( unofficial_item , null , 2 ) } ` ,
56- { cause : error } ,
57- )
58- }
59- >
60- < NavbarItem { ...unofficial_item } />
61- </ ErrorCauseBoundary >
62- ) ) }
50+ < ErrorCauseBoundary
51+ key = { unofficial_domain_item ?. label }
52+ onError = { ( error ) =>
53+ new Error (
54+ `A theme navbar item failed to render.
55+ Please double-check the following navbar item (themeConfig.navbar.items) of your Docusaurus config:
56+ ${ JSON . stringify ( unofficial_domain_item , null , 2 ) } ` ,
57+ { cause : error } ,
58+ )
59+ }
60+ >
61+ < NavbarItem { ...unofficial_domain_item } />
62+ </ ErrorCauseBoundary >
6363 </ React . Fragment >
6464 ) }
6565 </ >
0 commit comments