Skip to content

🎥 Make videos programmatically with React

`@remotion/lottie`: Don't refetch images on every frame

Jonny Burgerc611fb3c52bc
diff --git a/packages/lottie/src/Lottie.tsx b/packages/lottie/src/Lottie.tsx
index 28103827f6..047bd2bcc4 100644
--- a/packages/lottie/src/Lottie.tsx
+++ b/packages/lottie/src/Lottie.tsx
@@ -109,6 +109,14 @@ export const Lottie = ({
'image'
) as NodeListOf<SVGImageElement>;
images.forEach((img) => {
+ const currentHref = img.getAttributeNS(
+ 'http://www.w3.org/1999/xlink',
+ 'href'
+ );
+ if (currentHref && currentHref === img.href.baseVal) {
+ return;
+ }
+
const imgHandle = delayRender(
`Waiting for lottie image with src="${img.href.baseVal}" to load`
);