TagSpaces is an offline, open source, document manager with tagging support
fix indexing
sytolkd2aa2809d1e1
diff --git a/package-lock.json b/package-lock.jsonindex 6e451f5e4..ff79a0b68 100644--- a/package-lock.json+++ b/package-lock.json@@ -196,7 +196,7 @@"yarn": "please-use-npm"},"optionalDependencies": {- "@tagspacespro/tagspacespro": "5.0.13"+ "@tagspacespro/tagspacespro": "5.0.14"}},"node_modules/@aashutoshrathi/word-wrap": {@@ -13571,9 +13571,9 @@}},"node_modules/@tagspacespro/tagspacespro": {- "version": "5.0.13",- "resolved": "https://npm.pkg.github.com/download/@tagspacespro/tagspacespro/5.0.13/fe4027ab5b79468cb0cf299ab6170bbec21d2860",- "integrity": "sha512-dBcxQ3Rk8T/0yZc2PKhXhkoyuZ+G8AhOKpqJSLSorDFTMX9LHmnoil+QewKOle+VsZdO1B3kNQuEnnQTa0zmIA==",+ "version": "5.0.14",+ "resolved": "https://npm.pkg.github.com/download/@tagspacespro/tagspacespro/5.0.14/67074c511445683749565daf5fc43af1d0e05282",+ "integrity": "sha512-diFQCT8FX+ZHYm7YOpybGjnWKJrRGGPLtQW7bILkHE6SMGk0lnWWNxEWrs9nCaTuPyjkDy/ADSYopA4YQc1Y3A==","license": "Proprietary","optional": true},@@ -54686,9 +54686,9 @@}},"@tagspacespro/tagspacespro": {- "version": "5.0.13",- "resolved": "https://npm.pkg.github.com/download/@tagspacespro/tagspacespro/5.0.13/fe4027ab5b79468cb0cf299ab6170bbec21d2860",- "integrity": "sha512-dBcxQ3Rk8T/0yZc2PKhXhkoyuZ+G8AhOKpqJSLSorDFTMX9LHmnoil+QewKOle+VsZdO1B3kNQuEnnQTa0zmIA==",+ "version": "5.0.14",+ "resolved": "https://npm.pkg.github.com/download/@tagspacespro/tagspacespro/5.0.14/67074c511445683749565daf5fc43af1d0e05282",+ "integrity": "sha512-diFQCT8FX+ZHYm7YOpybGjnWKJrRGGPLtQW7bILkHE6SMGk0lnWWNxEWrs9nCaTuPyjkDy/ADSYopA4YQc1Y3A==","optional": true},"@teamsupercell/typings-for-css-modules-loader": {diff --git a/release/app/package-lock.json b/release/app/package-lock.jsonindex bc0411286..7f9e97958 100644--- a/release/app/package-lock.json+++ b/release/app/package-lock.json@@ -1,12 +1,12 @@{"name": "tagspaces",- "version": "5.7.6",+ "version": "5.7.7","lockfileVersion": 2,"requires": true,"packages": {"": {"name": "tagspaces",- "version": "5.7.6",+ "version": "5.7.7","hasInstallScript": true,"license": "AGPL-3.0","dependencies": {diff --git a/src/renderer/hooks/LocationIndexContextProvider.tsx b/src/renderer/hooks/LocationIndexContextProvider.tsxindex a255a3a7e..d7b635810 100644--- a/src/renderer/hooks/LocationIndexContextProvider.tsx+++ b/src/renderer/hooks/LocationIndexContextProvider.tsx@@ -16,7 +16,13 @@**/-import React, { createContext, useEffect, useMemo, useRef } from 'react';+import React, {+ createContext,+ useEffect,+ useMemo,+ useReducer,+ useRef,+} from 'react';import { useSelector } from 'react-redux';import { useTranslation } from 'react-i18next';import { TS } from '-/tagspaces.namespace';@@ -88,6 +94,7 @@ export const LocationIndexContextProvider = ({const lastError = useRef(undefined);const index = useRef<TS.FileSystemEntry[]>(undefined);const indexLoadedOn = useRef<number>(undefined);+ const [ignored, forceUpdate] = useReducer((x) => x + 1, 0, undefined);useEffect(() => {clearDirectoryIndex();@@ -181,6 +188,7 @@ export const LocationIndexContextProvider = ({function cancelDirectoryIndexing() {window.walkCanceled = true;isIndexing.current = false;+ forceUpdate();}function createDirIndex(@@ -191,6 +199,7 @@ export const LocationIndexContextProvider = ({ignorePatterns: Array<string> = [],): Promise<boolean> {isIndexing.current = true;+ forceUpdate();return createDirectoryIndex({ path: directoryPath, locationID },extractText,@@ -203,11 +212,13 @@ export const LocationIndexContextProvider = ({setIndex(directoryIndex);}isIndexing.current = false;+ forceUpdate();return true;}).catch((err) => {isIndexing.current = false;lastError.current = err;+ forceUpdate();return false;});}@@ -255,6 +266,7 @@ export const LocationIndexContextProvider = ({function createLocationsIndexes(extractText = true): Promise<boolean> {isIndexing.current = true;+ forceUpdate();const promises = allLocations.map((location: TS.Location) =>getLocationPath(location).then((locationPath) =>createDirectoryIndex(@@ -263,7 +275,6 @@ export const LocationIndexContextProvider = ({location.ignorePatternPaths,enableWS,).catch((err) => {- isIndexing.current = false;lastError.current = err;}),),@@ -272,10 +283,13 @@ export const LocationIndexContextProvider = ({return Promise.all(promises).then((e) => {isIndexing.current = false;+ forceUpdate();console.log('Resolution is complete!', e);return true;}).catch((e) => {+ isIndexing.current = false;+ forceUpdate();console.warn('Resolution is failed!', e);return false;});@@ -284,6 +298,7 @@ export const LocationIndexContextProvider = ({function clearDirectoryIndex() {isIndexing.current = false;setIndex([]);+ forceUpdate();}function searchLocationIndex(searchQuery: TS.SearchQuery) {@@ -549,7 +564,7 @@ export const LocationIndexContextProvider = ({indexUpdateSidecarTags,reflectUpdateSidecarMeta,};- }, [currentLocation, index, isIndexing.current]);+ }, [currentLocation, index.current, isIndexing.current]);return (<LocationIndexContext.Provider value={context}>