File tree Expand file tree Collapse file tree 3 files changed +8
-8
lines changed
packages/gitbook/src/components Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 22
33import React from 'react' ;
44
5- import { ClassValue , tcls } from '@/lib/tailwind' ;
65import { useHash } from '@/components/hooks' ;
6+ import { ClassValue , tcls } from '@/lib/tailwind' ;
77
88/**
99 * Details component rendered on client so it can expand dependent on url hash changes.
@@ -31,9 +31,8 @@ export function Details(props: {
3131 return ;
3232 }
3333 if ( hash === id ) {
34- setAnchorElement ( detailsRef . current )
35- }
36- else {
34+ setAnchorElement ( detailsRef . current ) ;
35+ } else {
3736 const activeElement = document . getElementById ( hash ) ;
3837 if ( activeElement && detailsRef . current ?. contains ( activeElement ) ) {
3938 setAnchorElement ( activeElement ) ;
Original file line number Diff line number Diff line change @@ -11,9 +11,9 @@ export function useHash() {
1111 global . addEventListener ( 'hashchange' , updateHash ) ;
1212 updateHash ( ) ;
1313 return ( ) => global . removeEventListener ( 'hashchange' , updateHash ) ;
14- // With next.js, the hashchange event is not triggered when the hash changes
15- // Instead a hack is to use the `useParams` hook to listen to changes in the hash
16- // https://github.com/vercel/next.js/discussions/49465#discussioncomment-5845312
14+ // With next.js, the hashchange event is not triggered when the hash changes
15+ // Instead a hack is to use the `useParams` hook to listen to changes in the hash
16+ // https://github.com/vercel/next.js/discussions/49465#discussioncomment-5845312
1717 } , [ params ] ) ;
1818 return hash ;
19- }
19+ }
Original file line number Diff line number Diff line change 11import React from 'react' ;
2+
23import { useHash } from './useHash' ;
34
45/**
You can’t perform that action at this time.
0 commit comments