From 5362b88b21d408fa2f46d3e1f59577a80784f120 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Sat, 9 Jul 2022 16:56:58 +0200 Subject: [PATCH] fix: bail-out from async `createLottie` after unmount --- src/Player.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Player.tsx b/src/Player.tsx index 4088ecd..b0e0de5 100644 --- a/src/Player.tsx +++ b/src/Player.tsx @@ -298,6 +298,10 @@ export class Player extends React.Component { animationData = await fetchResult.json(); } + if (this.unmounted) { + return; + } + // Clear previous animation, if any if (instance) { instance.destroy();