From 5a684513fe034fdd548ec67399660f543a412a2e Mon Sep 17 00:00:00 2001 From: Alex Andreev Date: Fri, 1 Apr 2022 15:22:03 +0300 Subject: [PATCH] Do not render Animate when not in need Signed-off-by: Alex Andreev --- src/renderer/components/animate/animate.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/renderer/components/animate/animate.tsx b/src/renderer/components/animate/animate.tsx index f8bbd9b137..b988f0d219 100644 --- a/src/renderer/components/animate/animate.tsx +++ b/src/renderer/components/animate/animate.tsx @@ -90,9 +90,13 @@ export class Animate extends React.Component { "--leave-duration": `${leaveDuration}ms`, } as React.CSSProperties; + if (!this.isVisible) { + return null; + } + return React.cloneElement(contentElem, { className: cssNames("Animate", name, contentElem.props.className, this.statusClassName), - children: this.isVisible ? contentElem.props.children : null, + children: contentElem.props.children, style: { ...contentElem.props.style, ...durations,