Skip to content

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

Clear search on location and directory change (#1520)

Stanimirb78c10e59a48
diff --git a/app/components/FolderContainer.tsx b/app/components/FolderContainer.tsx
index 18a7d6166..a15e1b3b7 100644
--- a/app/components/FolderContainer.tsx
+++ b/app/components/FolderContainer.tsx
@@ -197,6 +197,10 @@ interface Props {
}
const FolderContainer = (props: Props) => {
+ useEffect(() => {
+ setSearchVisible(false);
+ }, [props.currentDirectoryPath]);
+
useEffect(() => {
if (props.selectedEntries.length < 2) {
if (props.openedFiles.length > 0) {
diff --git a/app/components/SearchInline.tsx b/app/components/SearchInline.tsx
index 6a40aa2ac..efca31066 100644
--- a/app/components/SearchInline.tsx
+++ b/app/components/SearchInline.tsx
@@ -101,7 +101,7 @@ const MainSearchField = withStyles((theme: Theme) =>
)(TextField);
const SearchInline = (props: Props) => {
- const [, forceUpdate] = useReducer(x => x + 1, 0);
+ // const [, forceUpdate] = useReducer(x => x + 1, 0);
const textQuery = useRef<string>(props.searchQuery.textQuery);
const fileTypes = useRef<Array<string>>(
props.searchQuery.fileTypes
@@ -153,6 +153,10 @@ const SearchInline = (props: Props) => {
};
}, []); */
+ useEffect(() => {
+ mainSearchField.current.value = '';
+ }, [props.currentDirectory]);
+
useEffect(() => {
let txtQuery = props.searchQuery.textQuery || '';
diff --git a/app/components/menus/DirectoryMenu.tsx b/app/components/menus/DirectoryMenu.tsx
index 1321dfc46..e02bad5e1 100644
--- a/app/components/menus/DirectoryMenu.tsx
+++ b/app/components/menus/DirectoryMenu.tsx
@@ -123,7 +123,7 @@ const DirectoryMenu = (props: Props) => {
function reloadDirectory() {
props.onClose();
- props.loadDirectoryContent(props.directoryPath, false);
+ props.loadDirectoryContent(props.directoryPath, true);
}
function openDirectory() {
diff --git a/app/reducers/app.ts b/app/reducers/app.ts
index 6a041bb04..4e593701a 100644
--- a/app/reducers/app.ts
+++ b/app/reducers/app.ts
@@ -1621,7 +1621,7 @@ export const actions = {
const openFile = openedFiles[0];
if (openFile.editMode) {
// && openFile.changed) {
- entryForOpening = { ...openFile, shouldReload: false };
+ entryForOpening = { ...openFile, shouldReload: !openFile.shouldReload }; // false };
dispatch(actions.addToEntryContainer(entryForOpening));
return false;
}
diff --git a/app/services/platform-io.ts b/app/services/platform-io.ts
index 74acdc93e..45adaa23b 100644
--- a/app/services/platform-io.ts
+++ b/app/services/platform-io.ts
@@ -198,7 +198,7 @@ export default class PlatformIO {
path,
bucketName: objectStoreAPI.config().bucketName
};
- return objectStoreAPI.listDirectoryPromise(param, lite);
+ return PlatformIO.listObjectStoreDir(param, lite, extractText, ignorePatterns);
}
return nativeAPI.listDirectoryPromise(
path,
@@ -208,6 +208,13 @@ export default class PlatformIO {
);
};
+ static listObjectStoreDir = (
+ param: Object,
+ lite: boolean = true,
+ extractText: boolean = true,
+ ignorePatterns: Array<string> = []
+ ): Promise<Array<any>> => objectStoreAPI.listDirectoryPromise(param, lite, extractText, ignorePatterns);
+
static getPropertiesPromise = (path: string): Promise<any> => {
if (objectStoreAPI) {
const param = {
diff --git a/app/services/utils-io.ts b/app/services/utils-io.ts
index 9a4a6d859..26dc02466 100644
--- a/app/services/utils-io.ts
+++ b/app/services/utils-io.ts
@@ -467,7 +467,17 @@ export function createDirectoryIndex(
});
}
- return createIndex(param, extractText, ignorePatterns)
+ let listDirectoryPromise;
+ if (PlatformIO.haveObjectStoreSupport()) {
+ listDirectoryPromise = PlatformIO.listObjectStoreDir;
+ }
+
+ return createIndex(
+ param,
+ extractText,
+ ignorePatterns,
+ listDirectoryPromise
+ )
.then(directoryIndex =>
persistIndex(param, directoryIndex).then(success => {
if (success) {
diff --git a/package.json b/package.json
index fbca128f8..78df8ad6a 100644
--- a/package.json
+++ b/package.json
@@ -152,7 +152,7 @@
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "^4.0.0-alpha.57",
"@material-ui/pickers": "^3.2.10",
- "@tagspaces/tagspaces-platforms": "^1.0.44",
+ "@tagspaces/tagspaces-platforms": "^1.0.45",
"aws-amplify": "^3.3.27",
"aws-sdk": "^2.984.0",
"babel-polyfill": "^6.26.0",
diff --git a/yarn.lock b/yarn.lock
index 53dde9442..7640e27ce 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3362,10 +3362,10 @@
dependencies:
defer-to-connect "^1.0.1"
-"@tagspaces/tagspaces-platforms@^1.0.44":
- version "1.0.44"
- resolved "https://registry.yarnpkg.com/@tagspaces/tagspaces-platforms/-/tagspaces-platforms-1.0.44.tgz#1b5b043f3657156f40f913fb590bbe2d219c3482"
- integrity sha512-zf7nly6DA05ncYrwdSwgO6ygvVQLraicmRCEhmK6USIJRXKeGhqMpSJIaevwX2ihqzQXPI5hcnM8bZcLsyweyg==
+"@tagspaces/tagspaces-platforms@^1.0.45":
+ version "1.0.45"
+ resolved "https://registry.yarnpkg.com/@tagspaces/tagspaces-platforms/-/tagspaces-platforms-1.0.45.tgz#42ec8e1fa657467750231179c5e8e56419dad3c4"
+ integrity sha512-+FIIVjO5ezTUZqiIWTOKkK3DrTFShEWbt/dt7qbtRg+hRM30rmEuD39pLVUm/d0eHd0GvGkG90cCVXfU4ZuHYA==
"@testim/chrome-version@^1.0.7":
version "1.0.7"