Skip to content

Commit e0e2ed3

Browse files
authored
adding observer disconnect (github#26228)
1 parent 50a8de0 commit e0e2ed3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

components/ui/ScrollButton/ScrollButton.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ export const ScrollButton = ({ className, ariaLabel }: ScrollButtonPropsT) => {
2424
},
2525
{ threshold: [0] }
2626
)
27-
2827
observer.observe(document.getElementsByTagName('h1')[0])
28+
return () => {
29+
observer.disconnect()
30+
}
2931
}, [])
3032

3133
const onClick = () => {

0 commit comments

Comments
 (0)