Skip to content

Commit

Permalink
fix: adding conditionals to lottie destroy
Browse files Browse the repository at this point in the history
  • Loading branch information
tobi-bams committed Oct 7, 2024
1 parent 32bf064 commit ecd5fce
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const Equalizer = () => {

return () => {
if (lottieRef.current) {
lottieRef.current.destroy()
lottieRef?.current?.destroy()
}
}
}, [])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const Equalizer = () => {

return () => {
if (lottieRef.current) {
lottieRef.current.destroy()
lottieRef?.current?.destroy()
}
}
}, [])
Expand Down
2 changes: 1 addition & 1 deletion src/components/Stats/Animation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const Animation = () => {

return () => {
if (lottieRef.current) {
lottieRef.current.destroy()
lottieRef?.current?.destroy()
}
}
}, [])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const Animation = ({ meshId }: { meshId: string }) => {

return () => {
if (lottieRef.current) {
lottieRef.current.destroy()
lottieRef?.current?.destroy()
}
}
}, [meshId])
Expand Down
6 changes: 1 addition & 5 deletions src/components/common/SiriLikeButton/SiriLikeButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ export const SiriLikeButton = ({ children, ...props }: ButtonBaseProps) => {
const destroy = createBtn(ref)

return () => {
try {
destroy?.()
} catch (error) {
/* can't check destroy */
}
destroy?.()
}
}, [])

Expand Down

0 comments on commit ecd5fce

Please sign in to comment.