Skip to content

🎥 Make videos programmatically with React

add comment

jeetiss3cc9789a67ca
diff --git a/packages/cli/src/editor/components/FpsCounter.tsx b/packages/cli/src/editor/components/FpsCounter.tsx
index 69f953afff..3eee23a797 100644
--- a/packages/cli/src/editor/components/FpsCounter.tsx
+++ b/packages/cli/src/editor/components/FpsCounter.tsx
@@ -7,7 +7,11 @@ const Label = styled.div`
font-family: Arial, Helvetica, sans-serif;
`;
-const pushWithMaxSize = (arr: number[], value: number, maxSize: number): number[] => {
+const pushWithMaxSize = (
+ arr: number[],
+ value: number,
+ maxSize: number
+): number[] => {
arr.push(value);
return arr.slice(-maxSize);
};
@@ -48,6 +52,7 @@ export const FpsCounter: React.FC = () => {
fpsRef.current = 1000 / averageDistanceBetween;
if (previousUpdates.current.length == 2) setFps(fpsRef.current);
+ /* This effect should depends only on frame, otherwise it will push extra updates to ref and fps will be wrong */
}, [frame]);
useEffect(() => {