Animated Sticker: Avoid initializing RLottie after unmount
This commit is contained in:
parent
05f00511e5
commit
a087e7a429
@ -97,12 +97,23 @@ const AnimatedSticker: FC<OwnProps> = ({
|
|||||||
const playSegmentRef = useRef<[number, number]>();
|
const playSegmentRef = useRef<[number, number]>();
|
||||||
playSegmentRef.current = playSegment;
|
playSegmentRef.current = playSegment;
|
||||||
|
|
||||||
|
const isUnmountedRef = useRef();
|
||||||
|
useEffect(() => {
|
||||||
|
return () => {
|
||||||
|
isUnmountedRef.current = true;
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (animation || !tgsUrl || (sharedCanvas && !sharedCanvasCoords)) {
|
if (animation || !tgsUrl || (sharedCanvas && !sharedCanvasCoords)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const exec = () => {
|
const exec = () => {
|
||||||
|
if (isUnmountedRef.current) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const container = containerRef.current || sharedCanvas;
|
const container = containerRef.current || sharedCanvas;
|
||||||
if (!container) {
|
if (!container) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user