Skip to content

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

close dirTree on close Location (#1187)

Stanimir91b2dd917a14
diff --git a/app/components/DirectoryTreeView.tsx b/app/components/DirectoryTreeView.tsx
index 31d865b1a..8f5a8ef82 100644
--- a/app/components/DirectoryTreeView.tsx
+++ b/app/components/DirectoryTreeView.tsx
@@ -70,6 +70,12 @@ const DirectoryTreeView = forwardRef((props: Props, ref) => {
}
},
closeLocation() {
+ // setData(undefined);
+ if (isExpanded) {
+ setExpanded(false);
+ }
+ },
+ removeLocation() {
setData(undefined);
}
}));
diff --git a/app/components/LocationManager.tsx b/app/components/LocationManager.tsx
index e179de34d..450af4a6d 100644
--- a/app/components/LocationManager.tsx
+++ b/app/components/LocationManager.tsx
@@ -288,7 +288,8 @@ class LocationManager extends React.Component<Props, State> {
this.handleRequestCloseContextMenus();
if (this.state.selectedLocation && this.state.selectedLocation.uuid) {
this.props.closeLocation(this.state.selectedLocation.uuid);
- this.directoryTreeRef[this.state.selectedLocation.uuid] = undefined;
+ this.directoryTreeRef[this.state.selectedLocation.uuid].closeLocation();
+ // this.directoryTreeRef[this.state.selectedLocation.uuid] = undefined;
// this.directoryTreeRef[this.state.selectedLocation.uuid].closeLocation();
/* this.setState({
dirs: {}
@@ -688,6 +689,9 @@ class LocationManager extends React.Component<Props, State> {
confirmCallback={result => {
if (result && this.state.selectedLocation) {
this.props.removeLocation(this.state.selectedLocation);
+ this.directoryTreeRef[
+ this.state.selectedLocation.uuid
+ ].removeLocation();
}
}}
cancelDialogTID="cancelDeleteLocationDialog"