Skip to content

TagSpaces is an offline, open source, document manager with tagging support

code optimize

Stanimir Marinov79fc4349e6c0
diff --git a/app/reducers/app.js b/app/reducers/app.js
index e15c669fc..76c67ebb2 100644
--- a/app/reducers/app.js
+++ b/app/reducers/app.js
@@ -1223,25 +1223,19 @@ function prepareDirectoryContent(
dispatch(actions.showNotification('Generating thumbnails failed', 'warning', true));
}
- let genPromices = false;
if (tmbGenerationPromises.length > 0) {
- genPromices = true;
dispatch(actions.setGeneratingThumbnails(true));
// dispatch(actions.showNotification('Checking thumbnails', 'info', false));
Promise.all(tmbGenerationPromises)
.then(handleTmbGenerationResults)
.catch(handleTmbGenerationFailed);
- }
-
- if (tmbGenerationList.length > 0) {
- if (!genPromices) {
- dispatch(actions.setGeneratingThumbnails(true));
- }
+ } else if (tmbGenerationList.length > 0) {
+ dispatch(actions.setGeneratingThumbnails(true));
// dispatch(actions.showNotification('Loading or generating thumbnails...', 'info', false));
PlatformIO.createThumbnailsInWorker(tmbGenerationList)
.then(handleTmbGenerationResults)
.catch(handleTmbGenerationFailed);
- } else if (!genPromices) { // no dirEntries
+ } else { // no dirEntries
console.log('Dir ' + directoryPath + ' contains ' + directoryContent.length);
dispatch(actions.setGeneratingThumbnails(false));
dispatch(actions.loadDirectorySuccess(directoryPath, directoryContent));