Skip to content

🎥 Make videos programmatically with React

use normal map for gif cache

Jonny Burger7f23ec52b630
diff --git a/packages/gif/package.json b/packages/gif/package.json
index c87470d265..758ede5a8d 100644
--- a/packages/gif/package.json
+++ b/packages/gif/package.json
@@ -22,7 +22,6 @@
},
"dependencies": {
"js-binary-schema-parser": "^2.0.3",
- "lru_map": "0.4.1",
"remotion": "3.3.37"
},
"devDependencies": {
diff --git a/packages/gif/src/GifForDevelopment.tsx b/packages/gif/src/GifForDevelopment.tsx
index 129065ee5c..a5e7802dc0 100644
--- a/packages/gif/src/GifForDevelopment.tsx
+++ b/packages/gif/src/GifForDevelopment.tsx
@@ -85,6 +85,8 @@ export const GifForDevelopment = forwardRef<
cancel();
}
+ gifCache.delete(resolvedSrc);
+
continueRender(newHandle);
};
}, [id, resolvedSrc]);
diff --git a/packages/gif/src/GifForRendering.tsx b/packages/gif/src/GifForRendering.tsx
index 0dc402f83a..8e26e12e71 100644
--- a/packages/gif/src/GifForRendering.tsx
+++ b/packages/gif/src/GifForRendering.tsx
@@ -84,6 +84,7 @@ export const GifForRendering = forwardRef<HTMLCanvasElement, RemotionGifProps>(
}
continueRender(newHandle);
+ gifCache.delete(resolvedSrc);
};
}, [id, resolvedSrc]);
diff --git a/packages/gif/src/gif-cache.ts b/packages/gif/src/gif-cache.ts
index b09dd461f6..46e216575d 100644
--- a/packages/gif/src/gif-cache.ts
+++ b/packages/gif/src/gif-cache.ts
@@ -1,4 +1,3 @@
-import {LRUMap} from 'lru_map';
import type {GifState} from './props';
-export const gifCache = new LRUMap<string, GifState>(30);
+export const gifCache = new Map<string, GifState>();
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index f38df2f8db..333204e031 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -543,7 +543,6 @@ importers:
esbuild: 0.16.12
eslint: 8.25.0
js-binary-schema-parser: ^2.0.3
- lru_map: 0.4.1
prettier: 2.6.2
prettier-plugin-organize-imports: ^2.3.4
react: 18.0.0
@@ -553,7 +552,6 @@ importers:
webpack: 5.74.0
dependencies:
js-binary-schema-parser: 2.0.3
- lru_map: 0.4.1
remotion: link:../core
devDependencies:
'@jonny/eslint-config': 3.0.266_t54va6jeo5lf3vtqih5uiyrm5e
@@ -15736,10 +15734,6 @@ packages:
dependencies:
yallist: 4.0.0
- /lru_map/0.4.1:
- resolution: {integrity: sha512-I+lBvqMMFfqaV8CJCISjI3wbjmwVu/VyOoU7+qtu9d7ioW5klMgsTTiUOUp+DJvfTTzKXoPbyC6YfgkNcyPSOg==}
- dev: false
-
/lz-string/1.4.4:
resolution: {integrity: sha512-0ckx7ZHRPqb0oUm8zNr+90mtf9DQB60H1wMCjBtfi62Kl3a7JbHob6gA2bC+xRvZoOL+1hzUK8jeuEIQE8svEQ==}
hasBin: true