Skip to content

Commit

Permalink
adding observer disconnect (github#26228)
Browse files Browse the repository at this point in the history
  • Loading branch information
gracepark authored Mar 15, 2022
1 parent 50a8de0 commit e0e2ed3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion components/ui/ScrollButton/ScrollButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ export const ScrollButton = ({ className, ariaLabel }: ScrollButtonPropsT) => {
},
{ threshold: [0] }
)

observer.observe(document.getElementsByTagName('h1')[0])
return () => {
observer.disconnect()
}
}, [])

const onClick = () => {
Expand Down

0 comments on commit e0e2ed3

Please sign in to comment.