Remove deleted files from batch (#861)

* Remove deleted files from batch

* improve a bit

Co-authored-by: Mikael Finstad <finstaden@gmail.com>
pull/840/head^2
Michael Yaworski 2021-11-14 10:03:45 -05:00 zatwierdzone przez GitHub
rodzic 3e6a8791b9
commit 3db3241ccd
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 5 dodań i 1 usunięć

Wyświetl plik

@ -959,6 +959,8 @@ const App = memo(() => {
setBatchFiles([]);
}, [askBeforeClose]);
const removeBatchFile = useCallback((path) => setBatchFiles((existingBatch) => existingBatch.filter((existingFile) => existingFile.path !== path)), []);
const cleanupFiles = useCallback(async () => {
// Because we will reset state before deleting files
const saved = { previewFilePath, filePath, edlFilePath };
@ -978,6 +980,8 @@ const App = memo(() => {
if (workingRef.current) return;
removeBatchFile(saved.filePath);
try {
setWorking(i18n.t('Cleaning up'));
@ -1008,7 +1012,7 @@ const App = memo(() => {
} finally {
setWorking();
}
}, [filePath, previewFilePath, closeFile, edlFilePath, cleanupChoices, setWorking]);
}, [previewFilePath, filePath, edlFilePath, closeFile, cleanupChoices, removeBatchFile, setWorking]);
const outSegments = useMemo(() => (invertCutSegments ? inverseCutSegments : apparentCutSegments),
[invertCutSegments, inverseCutSegments, apparentCutSegments]);