From ecd5fcefe8e18505de9661da4d5262b12d3a0544 Mon Sep 17 00:00:00 2001 From: Oluwatobi Bamidele Date: Mon, 7 Oct 2024 21:27:42 +0100 Subject: [PATCH] fix: adding conditionals to lottie destroy --- .../App/ActionsToolbar/PlayerControl/Equalizer/index.tsx | 2 +- .../App/SideBar/Episode/Timestamp/Equalizer/index.tsx | 2 +- src/components/Stats/Animation/index.tsx | 2 +- .../Universe/Graph/LoadingNodes/Animation/index.tsx | 2 +- src/components/common/SiriLikeButton/SiriLikeButton.tsx | 6 +----- 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/components/App/ActionsToolbar/PlayerControl/Equalizer/index.tsx b/src/components/App/ActionsToolbar/PlayerControl/Equalizer/index.tsx index 9a755a458..00b293510 100644 --- a/src/components/App/ActionsToolbar/PlayerControl/Equalizer/index.tsx +++ b/src/components/App/ActionsToolbar/PlayerControl/Equalizer/index.tsx @@ -19,7 +19,7 @@ export const Equalizer = () => { return () => { if (lottieRef.current) { - lottieRef.current.destroy() + lottieRef?.current?.destroy() } } }, []) diff --git a/src/components/App/SideBar/Episode/Timestamp/Equalizer/index.tsx b/src/components/App/SideBar/Episode/Timestamp/Equalizer/index.tsx index d7a35dd13..2dc10c858 100644 --- a/src/components/App/SideBar/Episode/Timestamp/Equalizer/index.tsx +++ b/src/components/App/SideBar/Episode/Timestamp/Equalizer/index.tsx @@ -19,7 +19,7 @@ export const Equalizer = () => { return () => { if (lottieRef.current) { - lottieRef.current.destroy() + lottieRef?.current?.destroy() } } }, []) diff --git a/src/components/Stats/Animation/index.tsx b/src/components/Stats/Animation/index.tsx index 5620c23eb..604b1c3cf 100644 --- a/src/components/Stats/Animation/index.tsx +++ b/src/components/Stats/Animation/index.tsx @@ -19,7 +19,7 @@ export const Animation = () => { return () => { if (lottieRef.current) { - lottieRef.current.destroy() + lottieRef?.current?.destroy() } } }, []) diff --git a/src/components/Universe/Graph/LoadingNodes/Animation/index.tsx b/src/components/Universe/Graph/LoadingNodes/Animation/index.tsx index f1f21baf2..f25661f32 100644 --- a/src/components/Universe/Graph/LoadingNodes/Animation/index.tsx +++ b/src/components/Universe/Graph/LoadingNodes/Animation/index.tsx @@ -19,7 +19,7 @@ export const Animation = ({ meshId }: { meshId: string }) => { return () => { if (lottieRef.current) { - lottieRef.current.destroy() + lottieRef?.current?.destroy() } } }, [meshId]) diff --git a/src/components/common/SiriLikeButton/SiriLikeButton.tsx b/src/components/common/SiriLikeButton/SiriLikeButton.tsx index bdf55d59f..d94927fbd 100644 --- a/src/components/common/SiriLikeButton/SiriLikeButton.tsx +++ b/src/components/common/SiriLikeButton/SiriLikeButton.tsx @@ -9,11 +9,7 @@ export const SiriLikeButton = ({ children, ...props }: ButtonBaseProps) => { const destroy = createBtn(ref) return () => { - try { - destroy?.() - } catch (error) { - /* can't check destroy */ - } + destroy?.() } }, [])