@@ -24,18 +24,16 @@ export const useFAQAccordion = () => {
24
24
}
25
25
26
26
useEffect ( ( ) => {
27
- if ( typeof window !== 'undefined' ) {
28
- const hash = window . location . hash ? window . location . hash . split ( "#" ) [ 1 ] : ""
29
-
30
- if ( hash && buttonCreated ) {
31
- const anchor = document && document . getElementById ( hash )
32
- const heading : any = anchor && anchor . parentNode
33
-
34
- if ( heading ) {
35
- heading . parentNode . classList . toggle ( "open" )
36
- heading . classList . toggle ( "open" )
37
- toggleChildrenClass ( heading . parentNode )
38
- }
27
+ const hash = window . location . hash ? window . location . hash . split ( "#" ) [ 1 ] : ""
28
+
29
+ if ( hash && buttonCreated ) {
30
+ const anchor = document && document . getElementById ( hash )
31
+ const heading : any = anchor && anchor . parentNode
32
+
33
+ if ( heading ) {
34
+ heading . parentNode . classList . toggle ( "open" )
35
+ heading . classList . toggle ( "open" )
36
+ toggleChildrenClass ( heading . parentNode )
39
37
}
40
38
}
41
39
} , [ buttonCreated ] )
@@ -60,14 +58,12 @@ export const useFAQAccordion = () => {
60
58
e . target . localName === "button" ? e . target : e . target . parentNode
61
59
62
60
63
- if ( typeof window !== 'undefined' ) {
64
- window . history . replaceState (
65
- { } ,
66
- "" ,
67
- "#" + e . target . getElementsByTagName ( "a" ) [ 0 ] . id
68
- )
69
- window . history . scrollRestoration = "manual"
70
- }
61
+ window . history . replaceState (
62
+ { } ,
63
+ "" ,
64
+ "#" + e . target . getElementsByTagName ( "a" ) [ 0 ] . id
65
+ )
66
+ window . history . scrollRestoration = "manual"
71
67
72
68
if ( e . target . localName === "button" ) {
73
69
e . target . classList . toggle ( "open" )
0 commit comments