@@ -418,8 +418,17 @@ const NeonPage = (props) => {
418418 const sidebarHashMap = ! hasSidebarLinks ? { } : Object . fromEntries (
419419 sidebarLinks . map ( ( link , idx ) => [ link . hash || '#' , idx ] ) ,
420420 ) ;
421- const initialCurrentSidebarHash = sidebarLinks [ 0 ] . hash ;
422- const [ currentSidebarHash , setCurrentSidebarHash ] = useState ( initialCurrentSidebarHash ) ;
421+ const initialCurrentSidebarHash = ( ( ) => {
422+ if ( sidebarLinks . length === 5 ) {
423+ return sidebarLinks [ 3 ] . hash ;
424+ }
425+ if ( sidebarLinks . length === 7 ) {
426+ return sidebarLinks [ 1 ] . hash ;
427+ }
428+ return '#' ;
429+ } ) ( ) ;
430+ const currentSidebarHash = initialCurrentSidebarHash ;
431+ // const [currentSidebarHash, setCurrentSidebarHash] = useState(initialCurrentSidebarHash);
423432 const [ hashInitialized , setHashInitialized ] = useState ( false ) ;
424433 const [ sidebarExpanded , setSidebarExpanded ] = useState ( false ) ; // for small viewports only
425434
@@ -441,7 +450,7 @@ const NeonPage = (props) => {
441450 const handleHashChange = ( ) => {
442451 const { hash } = document . location ;
443452 if ( currentSidebarHash === hash ) { return ; }
444- setCurrentSidebarHash ( hash ) ;
453+ // setCurrentSidebarHash(hash);
445454 // If standard sidebar mode (scroll to content) also perform the scroll offset here
446455 if ( ! sidebarLinksAsStandaloneChildren ) {
447456 window . setTimeout ( ( ) => {
@@ -486,7 +495,7 @@ const NeonPage = (props) => {
486495 ( curr . y !== - 1 && window . scrollY >= curr . y - detectionBuffer ) ? curr . hash : acc
487496 ) , sidebarLinks [ 0 ] . hash || '#' ) ;
488497 if ( currentScrolledHash !== currentSidebarHash ) {
489- setCurrentSidebarHash ( currentScrolledHash ) ;
498+ // setCurrentSidebarHash(currentScrolledHash);
490499 }
491500 } ;
492501 window . addEventListener ( 'scroll' , handleScroll ) ;
@@ -503,7 +512,7 @@ const NeonPage = (props) => {
503512 hashInitialized ,
504513 setHashInitialized ,
505514 currentSidebarHash ,
506- setCurrentSidebarHash ,
515+ // setCurrentSidebarHash,
507516 sidebarLinksContainerRef ,
508517 getSidebarLinkScrollPosition ,
509518 sidebarLinksAsStandaloneChildren ,
@@ -808,7 +817,7 @@ const NeonPage = (props) => {
808817 href = { hash }
809818 onClick = { (
810819 sidebarLinksAsStandaloneChildren ? ( ) => {
811- setCurrentSidebarHash ( hash ) ;
820+ // setCurrentSidebarHash(hash);
812821 if ( sidebarExpanded ) { setSidebarExpanded ( false ) ; }
813822 } : null
814823 ) }
0 commit comments