Skip to content

Commit

Permalink
fix: remove event listeners on cleanup (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
giubatt authored Dec 15, 2021
1 parent 4738a8b commit ff4e2e3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/components/Avatar/hooks/useLoadedImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ const useLoadedImage = (
image.addEventListener("error", setError)
image.src = source
if (sourceSet) image.srcset = sourceSet

return () => {
image.removeEventListener("load", setLoaded)
image.removeEventListener("error", setError)
}
}, [setError, setLoaded, source, sourceSet])

return status
Expand Down

1 comment on commit ff4e2e3

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for herzui ready!

✅ Preview
https://herzui-p181in1xi-micromed.vercel.app

Built with commit ff4e2e3.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.