TagSpaces is an offline, open source, document manager with tagging support
fix splashWorker response (#1477)
Stanimir42a8030c3d2f
diff --git a/app/main.dev.ts b/app/main.dev.tsindex a7c5467c5..ba7d2d43c 100644--- a/app/main.dev.ts+++ b/app/main.dev.ts@@ -322,6 +322,13 @@ app.on('ready', async () => {}});+ ipcMain.on('worker-response', (event, arg) => {+ // console.log('worker event in main.' + arg.result.length);+ if (mainWindow) {+ mainWindow.webContents.send(arg.id, arg);+ }+ });+ipcMain.handle('select-directory-dialog', async () => {const options = {properties: ['openDirectory', 'createDirectory']@@ -338,13 +345,6 @@ app.on('ready', async () => {///// end electron-io- /*ipcMain.on('worker', (event, arg) => { TODO Why?- // console.log('worker event in main.' + arg.result.length);- if (mainWindow) {- mainWindow.webContents.send(arg.id, arg);- }- });*/-ipcMain.on('setSplashVisibility', (event, arg) => {// worker window needed to be visible for the PDF tmb generation// console.log('worker event in main: ' + arg.visibility);diff --git a/app/reducers/location-index.ts b/app/reducers/location-index.tsindex 49a349912..2f7303afa 100644--- a/app/reducers/location-index.ts+++ b/app/reducers/location-index.ts@@ -586,6 +586,7 @@ export const actions = {};// Selectors-export const getIndexedEntriesCount = (state: any) => GlobalSearch.index.length;+export const getIndexedEntriesCount = (state: any) =>+ GlobalSearch.index ? GlobalSearch.index.length : 0;export const isIndexing = (state: any) => state.locationIndex.isIndexing;export const getSearchQuery = (state: any) => state.locationIndex.searchQuery;diff --git a/app/splash-worker.ts b/app/splash-worker.tsindex 6b5650919..8c2cb000f 100644--- a/app/splash-worker.ts+++ b/app/splash-worker.ts@@ -65,7 +65,7 @@ function init() {directoryIndex.length);console.timeEnd('createDirectoryIndex');- ipcRenderer.send('worker', {+ ipcRenderer.send('worker-response', {id: arg.id,action: arg.action,result: directoryIndex,@@ -77,7 +77,7 @@ function init() {window.walkCanceled = false;console.timeEnd('createDirectoryIndex');console.warn('Error creating index: ' + err);- ipcRenderer.send('worker', {+ ipcRenderer.send('worker-response', {id: arg.id,action: arg.action,result: [], // directoryIndex,@@ -89,7 +89,7 @@ function init() {case 'createThumbnails': {console.log('createThumbnails started in worker window');if (!arg.tmbGenerationList || arg.tmbGenerationList.length < 1) {- ipcRenderer.send('worker', {+ ipcRenderer.send('worker-response', {id: arg.id,action: arg.action,result: [],@@ -105,7 +105,7 @@ function init() {Promise.all(tmbGenerationPromises) // TODO check allSettled.then(tmbResult => {console.log('tmb results' + JSON.stringify(tmbResult));- ipcRenderer.send('worker', {+ ipcRenderer.send('worker-response', {id: arg.id,action: arg.action,result: tmbResult,@@ -115,7 +115,7 @@ function init() {}).catch(error => {console.warn('Tmb generation failed: ' + error);- ipcRenderer.send('worker', {+ ipcRenderer.send('worker-response', {id: arg.id,action: arg.action,result: [],