TagSpaces is an offline, open source, document manager with tagging support
fix: search on empty index
Ilian Sapundshiev9f14f027104c
diff --git a/app/components/EntryContainer.tsx b/app/components/EntryContainer.tsxindex a1023a9ea..1369252c8 100644--- a/app/components/EntryContainer.tsx+++ b/app/components/EntryContainer.tsx@@ -243,7 +243,13 @@ const EntryContainer = (props: Props) => {// 'window.dispatchEvent(new Event("resume"));'// );// } else- if (fileViewer && fileViewer.current.contentWindow) {+ if (+ fileViewer &&+ fileViewer.current &&+ fileViewer.current.contentWindow &&+ // @ts-ignore+ fileViewer.current.contentWindow.togglePlay+ ) {// @ts-ignorefileViewer.current.contentWindow.togglePlay();}@@ -389,7 +395,13 @@ const EntryContainer = (props: Props) => {// false// );// } else- if (fileViewer) {+ if (+ fileViewer &&+ fileViewer.current &&+ fileViewer.current.contentWindow &&+ // @ts-ignore+ fileViewer.current.contentWindow.setContent+ ) {// @ts-ignorefileViewer.current.contentWindow.setContent(content,@@ -480,7 +492,13 @@ const EntryContainer = (props: Props) => {// );// }// } else- if (fileViewer) {+ if (+ fileViewer &&+ fileViewer.current &&+ fileViewer.current.contentWindow &&+ // @ts-ignore+ fileViewer.current.contentWindow.getContent+ ) {try {// @ts-ignoreconst textContent = fileViewer.current.contentWindow.getContent();diff --git a/app/reducers/location-index.ts b/app/reducers/location-index.tsindex 754d8619a..528cb9d01 100644--- a/app/reducers/location-index.ts+++ b/app/reducers/location-index.ts@@ -92,6 +92,9 @@ export default (state: any = initialState, action: any) => {};}case types.REFLECT_DELETE_ENTRY: {+ if (GlobalSearch.index.length < 1) {+ return state;+ }for (let i = 0; i < GlobalSearch.index.length; i += 1) {if (GlobalSearch.index[i].path === action.path) {GlobalSearch.index.splice(i, 1);@@ -101,6 +104,9 @@ export default (state: any = initialState, action: any) => {return state;}case types.REFLECT_CREATE_ENTRY: {+ if (GlobalSearch.index.length < 1) {+ return state;+ }let entryFound = false;for (let i = 0; i < GlobalSearch.index.length; i += 1) {if (GlobalSearch.index[i].path === action.path) {@@ -114,6 +120,9 @@ export default (state: any = initialState, action: any) => {return state;}case types.REFLECT_RENAME_ENTRY: {+ if (GlobalSearch.index.length < 1) {+ return state;+ }for (let i = 0; i < GlobalSearch.index.length; i += 1) {if (GlobalSearch.index[i].path === action.path) {GlobalSearch.index[i].path = action.newPath;diff --git a/scripts/setup-tests.js b/scripts/setup-tests.jsindex 5efdbbdd1..02f52e276 100644--- a/scripts/setup-tests.js+++ b/scripts/setup-tests.js@@ -41,7 +41,7 @@ extensionList.forEach(extension => {});// Download-const winUrl = 'http://dl.min.io/server/minio/release/windows-amd64/minio.exe';+const winUrl = 'https://dl.min.io/server/minio/release/windows-amd64/minio.exe';const linuxUrl = 'https://dl.min.io/server/minio/release/linux-amd64/minio';const macUrl = 'https://dl.min.io/server/minio/release/darwin-amd64/minio';const isWin = /^win/.test(process.platform);