From a8d47b827bea22f2c60bd70d67d68b59ec51ac6e Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Sun, 20 Aug 2023 15:49:40 +0200 Subject: [PATCH] refactor --- src/App.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index e3b70c89..1d4ba538 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -593,11 +593,11 @@ const App = memo(() => { const copyFileStreams = useMemo(() => Object.entries(copyStreamIdsByFile).map(([path, streamIdsMap]) => ({ path, - streamIds: Object.keys(streamIdsMap).filter(index => streamIdsMap[index]).map((streamIdStr) => parseInt(streamIdStr, 10)), + streamIds: Object.entries(streamIdsMap).filter(([, shouldCopy]) => shouldCopy).map(([streamIdStr]) => parseInt(streamIdStr, 10)), })), [copyStreamIdsByFile]); // total number of streams to copy for ALL files - const numStreamsToCopy = copyFileStreams.reduce((acc, { streamIds }) => acc + streamIds.length, 0); + const numStreamsToCopy = useMemo(() => copyFileStreams.reduce((acc, { streamIds }) => acc + streamIds.length, 0), [copyFileStreams]); const allFilesMeta = useMemo(() => ({ ...externalFilesMeta,