Skip to content

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

change location on switch dir from dirTree

Stanimire1c514b29034
diff --git a/src/renderer/hooks/CurrentLocationContextProvider.tsx b/src/renderer/hooks/CurrentLocationContextProvider.tsx
index f13356540..c861a5f5b 100644
--- a/src/renderer/hooks/CurrentLocationContextProvider.tsx
+++ b/src/renderer/hooks/CurrentLocationContextProvider.tsx
@@ -561,8 +561,9 @@ export const CurrentLocationContextProvider = ({
) {
skipInitialDirList.current = skipInitDirList;
if (
- !currentLocationId.current ||
- location.uuid !== currentLocationId.current
+ location &&
+ (!currentLocationId.current ||
+ location.uuid !== currentLocationId.current)
) {
if (location && location.name) {
document.title = location.name + ' | ' + versionMeta.name;
diff --git a/src/renderer/hooks/DirectoryContentContextProvider.tsx b/src/renderer/hooks/DirectoryContentContextProvider.tsx
index 43d2c4695..6f18be233 100644
--- a/src/renderer/hooks/DirectoryContentContextProvider.tsx
+++ b/src/renderer/hooks/DirectoryContentContextProvider.tsx
@@ -1010,13 +1010,12 @@ export const DirectoryContentContextProvider = ({
location: CommonLocation = undefined,
): Promise<boolean> {
if (dirPath !== undefined) {
- if (
+ /*if (
location &&
currentLocation &&
currentLocation.type !== location.type
- ) {
- changeLocation(location, true);
- }
+ ) {*/
+ changeLocation(location, true);
const cLocation = location || findLocation();
if (cLocation) {
return cLocation.checkDirExist(dirPath).then((exist) => {