TagSpaces is an offline, open source, document manager with tagging support
Executing a search history should switch to the root folder of the lo… (#1904)
Stanimir017ef4526ad1
diff --git a/app/components/EntryProperties.tsx b/app/components/EntryProperties.tsxindex fd2e7b863..30a699b62 100644--- a/app/components/EntryProperties.tsx+++ b/app/components/EntryProperties.tsx@@ -512,6 +512,7 @@ function EntryProperties(props: Props) {// eslint-disable-next-line no-param-reassigncolor = 'transparent';}+ currentEntry.current.color = color;props.switchLocationType(props.openedEntry.locationId).then(currentLocationId => {@@ -525,7 +526,6 @@ function EntryProperties(props: Props) {// todo handle LastBackgroundColorChange and skip updateOpenedFileprops.updateOpenedFile(currentEntry.current.path, entryMeta);props.switchCurrentLocationType(currentLocationId);-/* } else {setCurrentEntry({ ...currentEntry, color });} */diff --git a/app/components/FolderContainer.tsx b/app/components/FolderContainer.tsxindex 3658bdebc..e53b0a1eb 100644--- a/app/components/FolderContainer.tsx+++ b/app/components/FolderContainer.tsx@@ -302,7 +302,10 @@ function FolderContainer(props: Props) {currentPerspective = defaultPerspective;}- const showWelcomePanel = !currentDirectoryPath && directoryContent.length < 1;+ const showWelcomePanel =+ !currentDirectoryPath &&+ directoryContent.length < 1 &&+ !(props.isSearchMode && props.searchResultsCount >= 0);const renderPerspective = () => {if (showWelcomePanel) {diff --git a/app/components/SearchAutocomplete.tsx b/app/components/SearchAutocomplete.tsxindex 1817a896e..1a05ca84a 100644--- a/app/components/SearchAutocomplete.tsx+++ b/app/components/SearchAutocomplete.tsx@@ -1018,6 +1018,10 @@ function SearchAutocomplete(props: Props) {} else if (option.action === ExecActions.OPEN_HISTORY) {if (option.searchQuery) {if (option.id) {+ //if (props.currentLocation === undefined) {+ // props.openLocationById(option.id, true);+ // props.setSearchQuery(option.searchQuery);+ //} else {props.switchLocationTypeByID(option.id).then(() => {props.changeLocationByID(option.id);props.setSearchQuery(option.searchQuery);diff --git a/app/reducers/app.ts b/app/reducers/app.tsindex 4a8b3e519..b25523170 100644--- a/app/reducers/app.ts+++ b/app/reducers/app.ts@@ -1913,7 +1913,10 @@ export const actions = {getState(),currentLocationId);- if (location.type !== currentLocation.type) {+ if (+ currentLocation === undefined ||+ location.type !== currentLocation.type+ ) {return setLocationType(location).then(() => null);} else {// handle the same location type but different location@@ -1935,14 +1938,14 @@ export const actions = {return setLocationType(location);},- openLocationById: (locationId: string) => (+ openLocationById: (locationId: string, skipInitialDirList?: boolean) => (dispatch: (action) => void,getState: () => any) => {const { locations } = getState();locations.map(location => {if (location.uuid === locationId) {- dispatch(actions.openLocation(location));+ dispatch(actions.openLocation(location, skipInitialDirList));}return true;});@@ -2041,6 +2044,7 @@ export const actions = {dispatch(actions.clearDirectoryContent());dispatch(LocationIndexActions.clearDirectoryIndex());dispatch(actions.setSelectedEntries([]));+ dispatch(actions.exitSearchMode());if (Pro && Pro.Watcher) {Pro.Watcher.stopWatching();}diff --git a/app/reducers/location-index.ts b/app/reducers/location-index.tsindex 970bb339a..8df327926 100644--- a/app/reducers/location-index.ts+++ b/app/reducers/location-index.ts@@ -206,21 +206,23 @@ export const actions = {if (searchTitle.length > 0) {const historyKeys = Pro.history.historyKeys;const currentLocation = getCurrentLocation(getState());- Pro.history.saveHistory(- historyKeys.searchHistoryKey,- {- path:- searchTitle +- ' ' +- (currentLocation.path- ? currentLocation.path- : currentLocation.name),- url: '/',- lid: currentLocation.uuid,- searchQuery: searchQuery- },- getState().settings[historyKeys.searchHistoryKey]- );+ if (currentLocation) {+ Pro.history.saveHistory(+ historyKeys.searchHistoryKey,+ {+ path:+ searchTitle ++ ' ' ++ (currentLocation.path+ ? currentLocation.path+ : currentLocation.name),+ url: '/',+ lid: currentLocation.uuid,+ searchQuery: searchQuery+ },+ getState().settings[historyKeys.searchHistoryKey]+ );+ }}dispatch(AppActions.enterSearchMode());}