TagSpaces is an offline, open source, document manager with tagging support
Location context performance optimise (#2243)
Stanimiree3af7eb72f9
diff --git a/package-lock.json b/package-lock.jsonindex bf4c82ac8..9438f5601 100644--- a/package-lock.json+++ b/package-lock.json@@ -202,7 +202,7 @@"yarn": "please-use-npm"},"optionalDependencies": {- "@tagspacespro/tagspacespro": "5.0.112"+ "@tagspacespro/tagspacespro": "5.0.113"}},"node_modules/@adobe/css-tools": {@@ -15883,9 +15883,9 @@}},"node_modules/@tagspacespro/tagspacespro": {- "version": "5.0.112",- "resolved": "https://npm.pkg.github.com/download/@tagspacespro/tagspacespro/5.0.112/3e4863497c462d32b58afc3ba135016ba735122e",- "integrity": "sha512-4UuC8DUgaYyg6z+/MV9EYfVmjfFEe1mek+UkNYGMrYlpOuQR7WH1rlKZzNlHQSH8NbQGA0F2kBZqGJVHvyoYUg==",+ "version": "5.0.113",+ "resolved": "https://npm.pkg.github.com/download/@tagspacespro/tagspacespro/5.0.113/3ccf4aa7e155881eaab9359acfdab078519c9676",+ "integrity": "sha512-m5hHuLI9D1bH9HRe2ibUUiwGm9VZmqMXolJpnjN/9J3rgmFVUfe4srvngZjGjZciA7bFJ5owWS72nichNkNcCQ==","license": "Proprietary","optional": true},diff --git a/package.json b/package.jsonindex 5e6e605a1..f57d5ad00 100644--- a/package.json+++ b/package.json@@ -243,7 +243,7 @@"zod-to-json-schema": "^3.24.1"},"optionalDependencies": {- "@tagspacespro/tagspacespro": "5.0.112"+ "@tagspacespro/tagspacespro": "5.0.113"},"devDependencies": {"@electron/notarize": "^2.3.2",diff --git a/src/renderer/components/DirectoryListView.tsx b/src/renderer/components/DirectoryListView.tsxindex aa140e1e9..f0a357c70 100644--- a/src/renderer/components/DirectoryListView.tsx+++ b/src/renderer/components/DirectoryListView.tsx@@ -31,10 +31,10 @@ interface Props {function DirectoryListView(props: Props) {const { currentDirectoryPath, setTargetDir } = props;const { t } = useTranslation();- const { currentLocation, findLocation, locations } =- useCurrentLocationContext();+ const { findLocation, locations } = useCurrentLocationContext();const { openCreateDirectoryDialog } = useCreateDirectoryDialogContext();const showUnixHiddenEntries: boolean = useSelector(getShowUnixHiddenEntries);+ const currentLocation = findLocation();const chosenLocationId = useRef<string>(currentLocation ? currentLocation.uuid : undefined,);diff --git a/src/renderer/components/EntryContainerMenu.tsx b/src/renderer/components/EntryContainerMenu.tsxindex 8138d2613..80cf8a07d 100644--- a/src/renderer/components/EntryContainerMenu.tsx+++ b/src/renderer/components/EntryContainerMenu.tsx@@ -71,16 +71,16 @@ function EntryContainerMenu(props: Props) {sharingParentFolderLink,} = useOpenedEntryContext();const keyBindings = useSelector(getKeyBindingObject);- const { currentLocation, readOnlyMode } = useCurrentLocationContext();+ const { findLocation, readOnlyMode } = useCurrentLocationContext();const { deleteFile, downloadFsEntry } = useIOActionsContext();//const { showNotification } = useNotificationContext();const desktopMode = useSelector(isDesktopMode);const warningOpeningFilesExternally = useSelector(getWarningOpeningFilesExternally,);-const [isDeleteEntryModalOpened, setDeleteEntryModalOpened] =useState<boolean>(false);+ const currentLocation = findLocation();const navigateToFolder = () => {if (openedEntry.isFile) {diff --git a/src/renderer/components/FileSourceDnd.tsx b/src/renderer/components/FileSourceDnd.tsxindex 03c415032..c1a7fd90d 100644--- a/src/renderer/components/FileSourceDnd.tsx+++ b/src/renderer/components/FileSourceDnd.tsx@@ -16,7 +16,7 @@**/-import React from 'react';+import React, { useEffect } from 'react';import { useDrag } from 'react-dnd';import { getEmptyImage } from 'react-dnd-html5-backend';import DragItemTypes from './DragItemTypes';@@ -46,13 +46,16 @@ const FileSourceDnd: React.FC<Props> = ({ children }) => {}),});- // Use empty image as a drag preview so browsers don't draw it- // and we can draw whatever we want on the custom drag layer instead.- preview(getEmptyImage(), {- // IE fallback: specify that we'd rather screenshot the node- // when it already knows it's being dragged so we can hide it with CSS.- captureDraggingState: true,- });+ // Disable the default drag preview by using an empty image.+ useEffect(() => {+ // Use empty image as a drag preview so browsers don't draw it+ // and we can draw whatever we want on the custom drag layer instead.+ preview(getEmptyImage(), {+ // IE fallback: specify that we'd rather screenshot the node+ // when it already knows it's being dragged so we can hide it with CSS.+ captureDraggingState: true,+ });+ }, [preview]);return (<span ref={drag} {...collected}>diff --git a/src/renderer/components/LocationManager.tsx b/src/renderer/components/LocationManager.tsxindex 769ece0f9..ffa828e3d 100644--- a/src/renderer/components/LocationManager.tsx+++ b/src/renderer/components/LocationManager.tsx@@ -55,7 +55,7 @@ function LocationManager(props: Props) {const { t } = useTranslation();const {locations,- currentLocation,+ findLocation,addLocations,moveLocation,deleteLocation,@@ -105,6 +105,7 @@ function LocationManager(props: Props) {};const { reduceHeightBy, show } = props;+ const currentLocation = findLocation();return (<SidePanelstyle={{diff --git a/src/renderer/components/LocationView.tsx b/src/renderer/components/LocationView.tsxindex 35dafc68c..79fc3cad8 100644--- a/src/renderer/components/LocationView.tsx+++ b/src/renderer/components/LocationView.tsx@@ -64,7 +64,7 @@ function LocationView(props: Props) {const { openFileUploadDialog } = useFileUploadDialogContext();const {openLocation,- currentLocation,+ findLocation,readOnlyMode,setSelectedLocation,setLocationDirectoryContextMenuAnchorEl,@@ -78,7 +78,7 @@ function LocationView(props: Props) {const directoryTreeRef = useRef<DirectoryTreeViewRef>(null);const dispatch: AppDispatch = useDispatch();-+ const currentLocation = findLocation();const { location, hideDrawer } = props;const isCloudLocation = location.type === locationType.TYPE_CLOUD;diff --git a/src/renderer/components/MobileNavigation.tsx b/src/renderer/components/MobileNavigation.tsxindex 1028d568e..34b658581 100644--- a/src/renderer/components/MobileNavigation.tsx+++ b/src/renderer/components/MobileNavigation.tsx@@ -112,7 +112,7 @@ function MobileNavigation(props: Props) {const { t } = useTranslation();const theme = useTheme();const dispatch: AppDispatch = useDispatch();- const { setSelectedLocation, currentLocation } = useCurrentLocationContext();+ const { setSelectedLocation, findLocation } = useCurrentLocationContext();const { currentDirectoryPath } = useDirectoryContentContext();const { openFileUpload } = useFileUploadContext();const { openCreateEditLocationDialog } = useCreateEditLocationDialogContext();@@ -132,6 +132,7 @@ function MobileNavigation(props: Props) {const switchTheme = () => dispatch(SettingsActions.switchTheme());const [openedCreateMenu, setOpenCreateMenu] = React.useState(false);const anchorRef = React.useRef<HTMLDivElement>(null);+ const currentLocation = findLocation();const handleToggle = () => {setOpenCreateMenu((prevOpen) => !prevOpen);diff --git a/src/renderer/components/PathBreadcrumbs.tsx b/src/renderer/components/PathBreadcrumbs.tsxindex 2fe2d0355..51a35890f 100644--- a/src/renderer/components/PathBreadcrumbs.tsx+++ b/src/renderer/components/PathBreadcrumbs.tsx@@ -81,8 +81,9 @@ interface Props {function PathBreadcrumbs(props: Props) {const { t } = useTranslation();const { openDirectory, currentDirectoryPath } = useDirectoryContentContext();- const { currentLocation } = useCurrentLocationContext();+ const { findLocation } = useCurrentLocationContext();const { setSelectedEntries } = useSelectedEntriesContext();+ const currentLocation = findLocation();let pathParts: Array<string> = [];const [directoryContextMenuAnchorEl, setDirectoryContextMenuAnchorEl] =diff --git a/src/renderer/components/RenderPerspective.tsx b/src/renderer/components/RenderPerspective.tsxindex 132f27c82..3d1f9791a 100644--- a/src/renderer/components/RenderPerspective.tsx+++ b/src/renderer/components/RenderPerspective.tsx@@ -156,7 +156,7 @@ interface Props {function RenderPerspective(props: Props) {const { openRenameEntryDialog } = props;- const { currentLocation } = useCurrentLocationContext();+ const { currentLocationId } = useCurrentLocationContext();const { getPerspective } = useDirectoryContentContext();const { metaActions } = useEditedEntryMetaContext();const [ignored, forceUpdate] = useReducer((x) => x + 1, 0, undefined);@@ -172,7 +172,7 @@ function RenderPerspective(props: Props) {}}, [metaActions]);- const showWelcomePanel = !currentLocation;+ const showWelcomePanel = !currentLocationId;//!currentDirectoryPath && currentDirectoryEntries.length < 1;if (showWelcomePanel) {diff --git a/src/renderer/components/SearchAutocomplete.tsx b/src/renderer/components/SearchAutocomplete.tsxindex a08ed0c02..8f4a04d13 100644--- a/src/renderer/components/SearchAutocomplete.tsx+++ b/src/renderer/components/SearchAutocomplete.tsx@@ -95,7 +95,7 @@ function SearchAutocomplete(props: Props) {const desktopMode = useSelector(isDesktopMode);const theme = useTheme();const { openLink } = useOpenedEntryContext();- const { locations, currentLocation, changeLocationByID, openLocationById } =+ const { locations, currentLocationId, changeLocationByID, openLocationById } =useCurrentLocationContext();const {currentDirectoryPath,@@ -219,7 +219,7 @@ function SearchAutocomplete(props: Props) {}if (searchQuery.searchBoxing) {- const sBoxing = !currentLocation+ const sBoxing = !currentLocationId? scope.global: searchQuery.searchBoxing;setSearchBoxing(sBoxing);diff --git a/src/renderer/components/TagContainerDnd.tsx b/src/renderer/components/TagContainerDnd.tsxindex 21501ab49..a585196d3 100644--- a/src/renderer/components/TagContainerDnd.tsx+++ b/src/renderer/components/TagContainerDnd.tsx@@ -16,7 +16,7 @@**/-import React, { useRef } from 'react';+import React, { useEffect, useRef } from 'react';import { useDrag, useDrop } from 'react-dnd';import { getEmptyImage } from 'react-dnd-html5-backend';@@ -76,8 +76,9 @@ const TagContainerDnd = (props: Props) => {} = props;const { addTags } = useTaggingActionsContext();- const { currentLocation } = useCurrentLocationContext();+ const { findLocation } = useCurrentLocationContext();const tagContainerRef = useRef<HTMLSpanElement>(null);+ const currentLocation = findLocation();const endDrag = (item, monitor) => {// const item = monitor.getItem();@@ -224,13 +225,16 @@ const TagContainerDnd = (props: Props) => {// Implement hover logic here},*/});- // Use empty image as a drag preview so browsers don't draw it- // and we can draw whatever we want on the custom drag layer instead.- preview(getEmptyImage(), {- // IE fallback: specify that we'd rather screenshot the node- // when it already knows it's being dragged so we can hide it with CSS.- captureDraggingState: true,- });+ // Disable the default drag preview by using an empty image.+ useEffect(() => {+ // Use empty image as a drag preview so browsers don't draw it+ // and we can draw whatever we want on the custom drag layer instead.+ preview(getEmptyImage(), {+ // IE fallback: specify that we'd rather screenshot the node+ // when it already knows it's being dragged so we can hide it with CSS.+ captureDraggingState: true,+ });+ }, [preview]);const { isDragging } = collected;diff --git a/src/renderer/components/TargetFileBox.tsx b/src/renderer/components/TargetFileBox.tsxindex 4df82b9de..9b0043ce0 100644--- a/src/renderer/components/TargetFileBox.tsx+++ b/src/renderer/components/TargetFileBox.tsx@@ -124,7 +124,6 @@ function TargetFileBox(props: Props) {}if (files && files.length) {- const location = findLocation(locationId);if (AppConfig.isElectron) {files = files.map((file) => {if (!file.path) {@@ -133,7 +132,7 @@ function TargetFileBox(props: Props) {return file;});}-+ const location = findLocation(locationId);if (AppConfig.isElectron &&!location.haveObjectStoreSupport() &&diff --git a/src/renderer/components/dialogs/AddRemoveTagsDialog.tsx b/src/renderer/components/dialogs/AddRemoveTagsDialog.tsxindex 323e47def..7191ccfe1 100644--- a/src/renderer/components/dialogs/AddRemoveTagsDialog.tsx+++ b/src/renderer/components/dialogs/AddRemoveTagsDialog.tsx@@ -54,12 +54,13 @@ function AddRemoveTagsDialog(props: Props) {const { selectedEntries } = useSelectedEntriesContext();const selected = props.selected ? props.selected : selectedEntries;- const { currentLocation } = useCurrentLocationContext();+ const { findLocation } = useCurrentLocationContext();const { addTagsToFsEntries, removeTags, removeAllTags } =useTaggingActionsContext();const [newlyAddedTags, setNewlyAddedTags] = useState<TS.Tag[]>([]);const inputTags = useRef<TS.Tag[]>([]);const [ignored, forceUpdate] = useReducer((x) => x + 1, 0, undefined);+ const currentLocation = findLocation();const handleChange = (name: string, value: Array<TS.Tag>, action: string) => {if (action === 'remove-value') {diff --git a/src/renderer/components/dialogs/CreateDirectoryDialog.tsx b/src/renderer/components/dialogs/CreateDirectoryDialog.tsxindex d2b92eb0c..172de2fd7 100644--- a/src/renderer/components/dialogs/CreateDirectoryDialog.tsx+++ b/src/renderer/components/dialogs/CreateDirectoryDialog.tsx@@ -61,7 +61,7 @@ interface Props {function CreateDirectoryDialog(props: Props) {const { t } = useTranslation();const { createDirectory, setBackgroundColorChange } = useIOActionsContext();- const { currentLocation } = useCurrentLocationContext();+ const { findLocation } = useCurrentLocationContext();const { currentDirectoryPath, getAllPropertiesPromise } =useDirectoryContentContext();const { showNotification } = useNotificationContext();@@ -74,6 +74,7 @@ function CreateDirectoryDialog(props: Props) {const [ignored, forceUpdate] = useReducer((x) => x + 1, 0, undefined);const { open, onClose, selectedDirectoryPath } = props;+ const currentLocation = findLocation();const defaultBackgrounds = ['transparent',diff --git a/src/renderer/components/dialogs/DownloadUrlDialog.tsx b/src/renderer/components/dialogs/DownloadUrlDialog.tsxindex 305f1f794..fb938c502 100644--- a/src/renderer/components/dialogs/DownloadUrlDialog.tsx+++ b/src/renderer/components/dialogs/DownloadUrlDialog.tsx@@ -52,7 +52,8 @@ function DownloadUrlDialog(props: Props) {const { t } = useTranslation();const theme = useTheme();const smallScreen = useMediaQuery(theme.breakpoints.down('md'));- const { currentLocation, getFirstRWLocation } = useCurrentLocationContext();+ const { currentLocationId, findLocation, getFirstRWLocation } =+ useCurrentLocationContext();const { setReflectActions } = useEditedEntryContext();const { downloadUrl } = useIOActionsContext();const { showNotification } = useNotificationContext();@@ -73,7 +74,9 @@ function DownloadUrlDialog(props: Props) {function downloadURL() {if (fileUrl.current) {- const location = currentLocation ? currentLocation : getFirstRWLocation();+ const location = currentLocationId+ ? findLocation()+ : getFirstRWLocation();try {const url = new URL(fileUrl.current);if (invalidURL) {diff --git a/src/renderer/components/dialogs/FileUploadDialog.tsx b/src/renderer/components/dialogs/FileUploadDialog.tsxindex d3d1eb853..1f9dec7f2 100644--- a/src/renderer/components/dialogs/FileUploadDialog.tsx+++ b/src/renderer/components/dialogs/FileUploadDialog.tsx@@ -58,10 +58,11 @@ function FileUploadDialog(props: Props) {const theme = useTheme();const smallScreen = useMediaQuery(theme.breakpoints.down('md'));const { currentDirectoryPath } = useDirectoryContentContext();- const { currentLocation } = useCurrentLocationContext();+ const { findLocation } = useCurrentLocationContext();const progress = useSelector(getProgress);const targetPath = React.useRef<string>(getTargetPath()); // todo ContextProvider+ const currentLocation = findLocation();useEffect(() => {if (AppConfig.isElectron) {diff --git a/src/renderer/components/dialogs/IsTruncatedConfirmDialog.tsx b/src/renderer/components/dialogs/IsTruncatedConfirmDialog.tsxindex 724ecca4c..4ffda1ac8 100644--- a/src/renderer/components/dialogs/IsTruncatedConfirmDialog.tsx+++ b/src/renderer/components/dialogs/IsTruncatedConfirmDialog.tsx@@ -45,7 +45,8 @@ function IsTruncatedConfirmDialog(props: Props) {const { t } = useTranslation();const { openDirectory, currentDirectoryPath } = useDirectoryContentContext();- const { currentLocation, editLocation } = useCurrentLocationContext();+ const { findLocation, editLocation } = useCurrentLocationContext();+ const currentLocation = findLocation();let defaultMaxLoops = AppConfig.maxLoops;if (diff --git a/src/renderer/components/dialogs/LinkGeneratorDialog.tsx b/src/renderer/components/dialogs/LinkGeneratorDialog.tsxindex 457343ddd..1c3775754 100644--- a/src/renderer/components/dialogs/LinkGeneratorDialog.tsx+++ b/src/renderer/components/dialogs/LinkGeneratorDialog.tsx@@ -48,7 +48,7 @@ interface Props {function LinkGeneratorDialog(props: Props) {const { open, onClose, path } = props;const { t } = useTranslation();- const { findLocation, currentLocation } = useCurrentLocationContext();+ const { findLocation } = useCurrentLocationContext();const { openedEntry } = useOpenedEntryContext();const { showNotification } = useNotificationContext();const linkValidityDuration = useRef<number>(60 * 15);@@ -58,9 +58,7 @@ function LinkGeneratorDialog(props: Props) {const smallScreen = useMediaQuery(theme.breakpoints.down('md'));let location = findLocation(openedEntry?.locationID);- if (!location) {- location = currentLocation;- }+const gPath = path || openedEntry.path;useEffect(() => {diff --git a/src/renderer/components/dialogs/MoveCopyFilesDialog.tsx b/src/renderer/components/dialogs/MoveCopyFilesDialog.tsxindex 0fdfc939b..d01590a09 100644--- a/src/renderer/components/dialogs/MoveCopyFilesDialog.tsx+++ b/src/renderer/components/dialogs/MoveCopyFilesDialog.tsx@@ -39,7 +39,7 @@ interface Props {function MoveCopyFilesDialog(props: Props) {const { t } = useTranslation();const dispatch: AppDispatch = useDispatch();- const { currentLocation } = useCurrentLocationContext();+ const { findLocation } = useCurrentLocationContext();const { currentDirectoryPath } = useDirectoryContentContext();const { handleEntryExist, openEntryExistDialog } =useEntryExistDialogContext();@@ -58,6 +58,7 @@ function MoveCopyFilesDialog(props: Props) {const allEntries = useRef<TS.FileSystemEntry[]>(entries && entries.length > 0 ? entries : selectedEntries,);+ const currentLocation = findLocation();const selectedFiles = allEntries.current? allEntries.currentdiff --git a/src/renderer/components/dialogs/NewFileDialog.tsx b/src/renderer/components/dialogs/NewFileDialog.tsxindex 2a4d632d4..babd9a908 100644--- a/src/renderer/components/dialogs/NewFileDialog.tsx+++ b/src/renderer/components/dialogs/NewFileDialog.tsx@@ -53,7 +53,7 @@ function NewFileDialog(props: Props) {const { open, onClose, fileType } = props;const { t } = useTranslation();const { createFileAdvanced } = useOpenedEntryContext();- const { currentLocation, openLocation, getFirstRWLocation } =+ const { findLocation, openLocation, getFirstRWLocation } =useCurrentLocationContext();const { currentDirectoryPath } = useDirectoryContentContext();const { targetDirectoryPath } = useTargetPathContext();@@ -91,6 +91,7 @@ function NewFileDialog(props: Props) {}function loadLocation() {+ const currentLocation = findLocation();const isCloudLocation =currentLocation && currentLocation.type === locationType.TYPE_CLOUD;// no currentDirectoryPath in root cloud locationdiff --git a/src/renderer/components/dialogs/RenameEntryDialog.tsx b/src/renderer/components/dialogs/RenameEntryDialog.tsxindex 5d44a8c0b..09f982d5d 100644--- a/src/renderer/components/dialogs/RenameEntryDialog.tsx+++ b/src/renderer/components/dialogs/RenameEntryDialog.tsx@@ -50,7 +50,7 @@ function RenameEntryDialog(props: Props) {const { open, onClose } = props;const { t } = useTranslation();const { renameDirectory, renameFile } = useIOActionsContext();- const { currentLocation } = useCurrentLocationContext();+ const { findLocation } = useCurrentLocationContext();const { currentDirectoryPath } = useDirectoryContentContext();const { selectedEntries } = useSelectedEntriesContext();const lastSelectedEntry = selectedEntries[selectedEntries.length - 1];@@ -58,6 +58,7 @@ function RenameEntryDialog(props: Props) {const disableConfirmButton = useRef<boolean>(true);const theme = useTheme();const smallScreen = useMediaQuery(theme.breakpoints.down('md'));+ const currentLocation = findLocation();let defaultName = '';let originPath;diff --git a/src/renderer/components/dialogs/components/LocalForm.tsx b/src/renderer/components/dialogs/components/LocalForm.tsxindex ae31d8413..84e5fbc48 100644--- a/src/renderer/components/dialogs/components/LocalForm.tsx+++ b/src/renderer/components/dialogs/components/LocalForm.tsx@@ -41,7 +41,7 @@ interface Props {function LocalForm(props: Props) {const { errorTextPath, errorTextName, setName, setPath, path, name } = props;const { t } = useTranslation();- const { currentLocation } = useCurrentLocationContext();+ const { findLocation } = useCurrentLocationContext();const openDirectory = () => {selectDirectoryDialog()@@ -49,6 +49,7 @@ function LocalForm(props: Props) {const selectedPath = decodeURI(selectedPaths[0]);setPath(selectedPath);if (name.length < 1 && selectedPath.length > 0) {+ const currentLocation = findLocation();const dirName = extractDirectoryName(selectedPath,currentLocation?.getDirSeparator(),diff --git a/src/renderer/components/dialogs/components/TargetPath.tsx b/src/renderer/components/dialogs/components/TargetPath.tsxindex 0838e2a90..4b1da2c82 100644--- a/src/renderer/components/dialogs/components/TargetPath.tsx+++ b/src/renderer/components/dialogs/components/TargetPath.tsx@@ -26,8 +26,9 @@ import { useCurrentLocationContext } from '-/hooks/useCurrentLocationContext';function TargetPath() {const { t } = useTranslation();- const { currentLocation } = useCurrentLocationContext();+ const { findLocation } = useCurrentLocationContext();const { targetDirectoryPath } = useTargetPathContext();+ const currentLocation = findLocation();return (<Grid item style={{ marginTop: 20 }} xs={12}>diff --git a/src/renderer/components/dialogs/hooks/TargetPathContextProvider.tsx b/src/renderer/components/dialogs/hooks/TargetPathContextProvider.tsxindex a180d867a..52d0f8472 100644--- a/src/renderer/components/dialogs/hooks/TargetPathContextProvider.tsx+++ b/src/renderer/components/dialogs/hooks/TargetPathContextProvider.tsx@@ -38,7 +38,7 @@ export type TargetPathContextProviderProps = {export const TargetPathContextProvider = ({children,}: TargetPathContextProviderProps) => {- const { currentLocation, getFirstRWLocation } = useCurrentLocationContext();+ const { findLocation, getFirstRWLocation } = useCurrentLocationContext();const { selectedEntries } = useSelectedEntriesContext();const { currentDirectoryPath, getPerspective } = useDirectoryContentContext();@@ -56,6 +56,7 @@ export const TargetPathContextProvider = ({}if (!targetDirectoryPath) {+ const currentLocation = findLocation();const isCloudLocation =currentLocation && currentLocation.type === locationType.TYPE_CLOUD;if (isCloudLocation) {diff --git a/src/renderer/components/menus/DirectoryMenu.tsx b/src/renderer/components/menus/DirectoryMenu.tsxindex acb298ba7..f189eb40a 100644--- a/src/renderer/components/menus/DirectoryMenu.tsx+++ b/src/renderer/components/menus/DirectoryMenu.tsx@@ -82,7 +82,7 @@ function DirectoryMenu(props: Props) {const { addTags } = useTaggingActionsContext();const { openProgressDialog } = useProgressDialogContext();const { openNewFileDialog } = useNewFileDialogContext();- const { currentLocation, readOnlyMode, getLocationPath, findLocation } =+ const { readOnlyMode, getLocationPath, findLocation } =useCurrentLocationContext();const { setThumbnailImageChange, getMetadataID } = useIOActionsContext();const { showNotification } = useNotificationContext();@@ -115,10 +115,11 @@ function DirectoryMenu(props: Props) {switchPerspective,perspectiveMode,} = props;+ const currentLocation = findLocation();const directoryPath = props.directoryPath || currentDirectoryPath;function generateFolderLink(): Promise<any> {- let locationID = currentLocation.uuid;+ let locationID = undefined;let entryPath = currentDirectoryPath;if (selectedEntries && selectedEntries.length > 0) {if (selectedEntries[0]['locationID']) {diff --git a/src/renderer/components/menus/FileMenu.tsx b/src/renderer/components/menus/FileMenu.tsxindex 9dfb2b7ee..66d9e9ac5 100644--- a/src/renderer/components/menus/FileMenu.tsx+++ b/src/renderer/components/menus/FileMenu.tsx@@ -124,9 +124,11 @@ function FileMenu(props: Props) {useDirectoryContentContext();const { showNotification } = useNotificationContext();const { setFolderThumbnailPromise } = usePlatformFacadeContext();- const { currentLocation, readOnlyMode } = useCurrentLocationContext();+ const { currentLocationId, findLocation, readOnlyMode } =+ useCurrentLocationContext();const downloadFileUrl = useRef<string>(undefined);const [ignored, forceUpdate] = useReducer((x) => x + 1, 0, undefined);+ const currentLocation = findLocation();useEffect(() => {if (currentLocation.haveObjectStoreSupport()) {@@ -137,7 +139,7 @@ function FileMenu(props: Props) {forceUpdate();});}- }, [currentLocation, selectedFilePath]);+ }, [currentLocationId, selectedFilePath]);function generateFileLink(): Promise<string> {const entryPath = selectedEntries[0].path;@@ -147,7 +149,7 @@ function FileMenu(props: Props) {selectedEntries[0].uuid,currentLocation,).then((id) =>- generateSharingLink(currentLocation.uuid, relativePath, undefined, id),+ generateSharingLink(currentLocationId, relativePath, undefined, id),);}diff --git a/src/renderer/hooks/BrowserHistoryContextProvider.tsx b/src/renderer/hooks/BrowserHistoryContextProvider.tsxindex f4f21b04d..1a7ee3f61 100644--- a/src/renderer/hooks/BrowserHistoryContextProvider.tsx+++ b/src/renderer/hooks/BrowserHistoryContextProvider.tsx@@ -33,7 +33,8 @@ export type BrowserHistoryContextProviderProps = {export const BrowserHistoryContextProvider = ({children,}: BrowserHistoryContextProviderProps) => {- const { currentLocation, openLocationById } = useCurrentLocationContext();+ const { currentLocationId, findLocation, openLocationById } =+ useCurrentLocationContext();const { openedEntry, openLink, openEntry } = useOpenedEntryContext();const { currentLocationPath, currentDirectoryPath } =useDirectoryContentContext();@@ -42,6 +43,7 @@ export const BrowserHistoryContextProvider = ({);const historyIndex = useRef<number>(0);const [ignored, forceUpdate] = useReducer((x) => x + 1, 0, undefined);+ const currentLocation = findLocation();useEffect(() => {if (AppConfig.isElectron) {@@ -99,8 +101,8 @@ export const BrowserHistoryContextProvider = ({);addHistory(currentDirectoryPath,- generateSharingLink(currentLocation.uuid, relEntryPath, relEntryPath),- currentLocation.uuid,+ generateSharingLink(currentLocationId, relEntryPath, relEntryPath),+ currentLocationId,);}}, [currentDirectoryPath]);@@ -150,7 +152,7 @@ export const BrowserHistoryContextProvider = ({if (item.url) {openLink(item.url, { fullWidth: false });} else {- if (item.lid !== currentLocation.uuid) {+ if (item.lid !== currentLocationId) {openLocationById(item.lid);}openEntry(item.path);diff --git a/src/renderer/hooks/ChatProvider.tsx b/src/renderer/hooks/ChatProvider.tsxindex 63ec1c4f0..7e23a1529 100644--- a/src/renderer/hooks/ChatProvider.tsx+++ b/src/renderer/hooks/ChatProvider.tsx@@ -204,7 +204,7 @@ export const ChatContextProvider = ({ children }: ChatContextProviderProps) => {const { addTagsToFsEntry } = useTaggingActionsContext();const { openFileUploadDialog } = useFileUploadDialogContext();const { selectedEntries } = useSelectedEntriesContext();- const { currentLocation } = useCurrentLocationContext();+ const { findLocation } = useCurrentLocationContext();const { saveFilePromise, deleteEntriesPromise } = usePlatformFacadeContext();const { openedEntry } = useOpenedEntryContext();const models = useRef<ModelResponse[]>([]);@@ -240,6 +240,7 @@ export const ChatContextProvider = ({ children }: ChatContextProviderProps) => {const ollamaClient = useRef<Ollama>(undefined);const dispatch: AppDispatch = useDispatch();const [ignored, forceUpdate] = useReducer((x) => x + 1, 0, undefined);+ const currentLocation = findLocation();/*useEffect(() => {diff --git a/src/renderer/hooks/CurrentLocationContextProvider.tsx b/src/renderer/hooks/CurrentLocationContextProvider.tsxindex 96f31dfc3..8c2583a67 100644--- a/src/renderer/hooks/CurrentLocationContextProvider.tsx+++ b/src/renderer/hooks/CurrentLocationContextProvider.tsx@@ -45,13 +45,14 @@ import { TS } from '-/tagspaces.namespace';type CurrentLocationContextData = {locations: CommonLocation[];- currentLocation: CommonLocation;+ //currentLocation: CommonLocation;currentLocationId: string;readOnlyMode: boolean;skipInitialDirList: boolean;persistTagsInSidecarFile: boolean;getLocationPath: (location: CommonLocation) => Promise<string>;- findLocation: (locationID: string) => CommonLocation;+ findLocation: (locationID?: string) => CommonLocation;+ getDirSeparator: (locationID?: string) => string;findLocalLocation: () => CommonLocation;changeLocation: (location: CommonLocation, skipInitDirList?: boolean) => void;editLocation: (location: CommonLocation, openAfterEdit?: boolean) => void;@@ -87,13 +88,14 @@ type CurrentLocationContextData = {export const CurrentLocationContext = createContext<CurrentLocationContextData>({locations: undefined,- currentLocation: undefined,+ //currentLocation: undefined,currentLocationId: undefined,readOnlyMode: false,skipInitialDirList: false,persistTagsInSidecarFile: true,getLocationPath: undefined,findLocation: undefined,+ getDirSeparator: undefined,findLocalLocation: undefined,changeLocation: () => {},editLocation: () => {},@@ -137,7 +139,7 @@ export const CurrentLocationContextProvider = ({const allLocations = useRef<CommonLocation[]>(locations.map((l) => new CommonLocation(l)),);- const currentLocation = useRef<string>(undefined); //defaultLocationId);+ const currentLocationId = useRef<string>(undefined); //defaultLocationId);const selectedLocation = useRef<CommonLocation>(undefined);const skipInitialDirList = useRef<boolean>(false);const initLocations = useRef<boolean>(false);@@ -152,7 +154,7 @@ export const CurrentLocationContextProvider = ({useEffect(() => {if (- !currentLocation.current &&+ !currentLocationId.current &&defaultLocationId &&defaultLocationId.length > 0) {@@ -199,9 +201,9 @@ export const CurrentLocationContextProvider = ({setDefaultLocations();} else {// check if current location exist (or is removed)- if (currentLocation.current) {+ if (currentLocationId.current) {const location = locations.find(- (location) => location.uuid === currentLocation.current,+ (location) => location.uuid === currentLocationId.current,);if (!location) {setCurrentLocation(undefined);@@ -254,13 +256,24 @@ export const CurrentLocationContextProvider = ({function findLocation(locationID: string = undefined): CommonLocation {if (!locationID) {- locationID = currentLocation.current;+ return allLocations.current.find(+ (l) => l.uuid === currentLocationId.current,+ );}const loc = allLocations.current.find((l) => l.uuid === locationID);if (loc) {return loc;}- return undefined;+ return allLocations.current.find(+ (l) => l.uuid === currentLocationId.current,+ );+ }+ function getDirSeparator(locationID: string = undefined): string {+ const loc = findLocation(locationID);+ if (loc) {+ return loc.getDirSeparator();+ }+ return AppConfig.dirSeparator;}function findLocalLocation(): CommonLocation {@@ -448,8 +461,8 @@ export const CurrentLocationContextProvider = ({function setCurrentLocation(location) {const newLocationId = location?.uuid;- if (currentLocation.current !== newLocationId) {- currentLocation.current = newLocationId;+ if (currentLocationId.current !== newLocationId) {+ currentLocationId.current = newLocationId;forceUpdate();}}@@ -471,7 +484,7 @@ export const CurrentLocationContextProvider = ({dispatch(LocationActions.changeLocation(location));forceUpdate();if (openAfterEdit) {- currentLocation.current = location.uuid;+ currentLocationId.current = location.uuid;/** check if location uuid is changed*/@@ -498,33 +511,38 @@ export const CurrentLocationContextProvider = ({return foundLocation;}- const location: CommonLocation = useMemo(+ /*const location: CommonLocation = useMemo(() => findLocation(),[currentLocation.current, allLocations.current],- );+ );*/const readOnlyMode: boolean = useMemo(() => {- if (location) {- return location.isReadOnly;+ if (currentLocationId.current) {+ const location = findLocation();+ return location?.isReadOnly;}return false;- }, [currentLocation.current]);+ }, [currentLocationId.current]);const persistTagsInSidecarFile: boolean = useMemo(() => {+ const location = findLocation();const locationPersistTagsInSidecarFile =location && location.persistTagsInSidecarFile;if (locationPersistTagsInSidecarFile !== undefined) {return locationPersistTagsInSidecarFile;}return settingsPersistTagsInSidecarFile;- }, [location, settingsPersistTagsInSidecarFile]);+ }, [currentLocationId.current, settingsPersistTagsInSidecarFile]);function changeLocation(location: CommonLocation,skipInitDirList: boolean = false,) {skipInitialDirList.current = skipInitDirList;- if (!currentLocation.current || location.uuid !== currentLocation.current) {+ if (+ !currentLocationId.current ||+ location.uuid !== currentLocationId.current+ ) {if (location && location.name) {document.title = location.name + ' | ' + versionMeta.name;}@@ -533,7 +551,10 @@ export const CurrentLocationContextProvider = ({}function changeLocationByID(locationId: string) {- if (!currentLocation.current || locationId !== currentLocation.current) {+ if (+ !currentLocationId.current ||+ locationId !== currentLocationId.current+ ) {const location = findLocation(locationId);if (location) {setCurrentLocation(location);@@ -564,7 +585,7 @@ export const CurrentLocationContextProvider = ({}function closeLocation(locationId: string) {- if (currentLocation.current && currentLocation.current === locationId) {+ if (currentLocationId.current && currentLocationId.current === locationId) {locations.map((location) => {if (location.uuid === locationId) {// location needed evtl. to unwatch many loc. root folders if available@@ -589,20 +610,21 @@ export const CurrentLocationContextProvider = ({return locations.findIndex((location) => location.uuid === locationId);}- function isCurrentLocation(uuid: string) {+ /*function isCurrentLocation(uuid: string) {return currentLocation.current && currentLocation.current === uuid;- }+ }*/const context = useMemo(() => {return {locations: allLocations.current,- currentLocation: location,- currentLocationId: currentLocation.current,+ //currentLocation: location,+ currentLocationId: currentLocationId.current,readOnlyMode,skipInitialDirList: skipInitialDirList.current,persistTagsInSidecarFile,getLocationPath,findLocation,+ getDirSeparator,findLocalLocation,changeLocation,addLocation,@@ -626,7 +648,7 @@ export const CurrentLocationContextProvider = ({};}, [allLocations.current,- currentLocation.current,+ currentLocationId.current,selectedLocation.current,persistTagsInSidecarFile,skipInitialDirList.current,diff --git a/src/renderer/hooks/DirectoryContentContextProvider.tsx b/src/renderer/hooks/DirectoryContentContextProvider.tsxindex d842694c0..845b41bbc 100644--- a/src/renderer/hooks/DirectoryContentContextProvider.tsx+++ b/src/renderer/hooks/DirectoryContentContextProvider.tsx@@ -253,7 +253,7 @@ export const DirectoryContentContextProvider = ({const broadcast = new BroadcastChannel('ts-directory-channel');const defaultColumnsToShow = 3;- const currentLocation = findLocation(currentLocationId);+ const currentLocation = findLocation();useEffect(() => {if (AppConfig.isElectron) {@@ -1183,7 +1183,7 @@ export const DirectoryContentContextProvider = ({entryPath: string,locationID: string = undefined,): Promise<TS.FileSystemEntry> {- const location = locationID ? findLocation(locationID) : currentLocation;+ const location = findLocation(locationID);return location.checkFileEncryptedPromise(entryPath).then((encrypted) =>location.getPropertiesPromise(entryPath, encrypted)diff --git a/src/renderer/hooks/FSWatcherContextProvider.tsx b/src/renderer/hooks/FSWatcherContextProvider.tsxindex e62dabc79..fd5a3576e 100644--- a/src/renderer/hooks/FSWatcherContextProvider.tsx+++ b/src/renderer/hooks/FSWatcherContextProvider.tsx@@ -59,7 +59,7 @@ export type FSWatcherContextProviderProps = {export const FSWatcherContextProvider = ({children,}: FSWatcherContextProviderProps) => {- const { currentLocation } = useCurrentLocationContext();+ const { currentLocationId, findLocation } = useCurrentLocationContext();const {getAllPropertiesPromise,currentDirectoryEntries,@@ -72,6 +72,7 @@ export const FSWatcherContextProvider = ({const watchingFolderPath = useRef<string>(undefined);let timer; // Timer variable to delay batch executionconst actionsQueue: TS.EditAction[] = [];+ const currentLocation = findLocation();useEffect(() => {if (@@ -87,7 +88,7 @@ export const FSWatcherContextProvider = ({} else {stopWatching();}- }, [currentLocation, currentDirectoryPath]);+ }, [currentLocationId, currentDirectoryPath]);function watchFolder(locationPath, depth) {if (diff --git a/src/renderer/hooks/IOActionsContextProvider.tsx b/src/renderer/hooks/IOActionsContextProvider.tsxindex 1c70ddaec..84255862d 100644--- a/src/renderer/hooks/IOActionsContextProvider.tsx+++ b/src/renderer/hooks/IOActionsContextProvider.tsx@@ -291,8 +291,7 @@ export const IOActionsContextProvider = ({const { setReflectKanBanActions } = useEditedKanBanMetaContext();const { currentDirectoryPath, openDirectory, getAllPropertiesPromise } =useDirectoryContentContext();- const { currentLocation, findLocation, getFirstRWLocation } =- useCurrentLocationContext();+ const { findLocation, getFirstRWLocation } = useCurrentLocationContext();const { reflectUpdateSidecarMeta } = useLocationIndexContext();const warningOpeningFilesExternally = useSelector(getWarningOpeningFilesExternally,@@ -300,6 +299,7 @@ export const IOActionsContextProvider = ({const prefixTagContainer = useSelector(getPrefixTagContainer);const filenameTagPlacedAtEnd = useSelector(getFileNameTagPlace);const firstRender = useFirstRender();+ const currentLocation = findLocation();useEffect(() => {if (!firstRender && actions && actions.length > 0) {diff --git a/src/renderer/hooks/LocationIndexContextProvider.tsx b/src/renderer/hooks/LocationIndexContextProvider.tsxindex a14f7cc9a..b696d016c 100644--- a/src/renderer/hooks/LocationIndexContextProvider.tsx+++ b/src/renderer/hooks/LocationIndexContextProvider.tsx@@ -96,7 +96,7 @@ export const LocationIndexContextProvider = ({}: LocationIndexContextProviderProps) => {const { t } = useTranslation();- const { locations, findLocation, currentLocation, getLocationPath } =+ const { locations, findLocation, currentLocationId, getLocationPath } =useCurrentLocationContext();const { ignoreByWatcher, deignoreByWatcher } = useFSWatcherContext();const { setSearchResults, appendSearchResults, updateCurrentDirEntries } =@@ -114,14 +114,15 @@ export const LocationIndexContextProvider = ({const indexLoadedOn = useRef<number>(undefined);const [ignored, forceUpdate] = useReducer((x) => x + 1, 0, undefined);const firstRender = useFirstRender();+ const currentLocation = findLocation();const maxIndexAge = useRef<number>(getMaxIndexAge(currentLocation));useEffect(() => {- if (currentLocation) {+ if (currentLocationId) {clearDirectoryIndex(false);- maxIndexAge.current = getMaxIndexAge(currentLocation);+ maxIndexAge.current = getMaxIndexAge(findLocation());}- }, [currentLocation]);+ }, [currentLocationId]);useEffect(() => {if (!firstRender && actions && actions.length > 0) {diff --git a/src/renderer/hooks/OpenedEntryContextProvider.tsx b/src/renderer/hooks/OpenedEntryContextProvider.tsxindex 53fd3cfd1..31f7b1a9c 100644--- a/src/renderer/hooks/OpenedEntryContextProvider.tsx+++ b/src/renderer/hooks/OpenedEntryContextProvider.tsx@@ -151,13 +151,8 @@ export const OpenedEntryContextProvider = ({const dispatch: AppDispatch = useDispatch();const { t } = useTranslation();- const {- currentLocation,- findLocation,- openLocation,- getLocationPath,- getFirstRWLocation,- } = useCurrentLocationContext();+ const { findLocation, openLocation, getLocationPath, getFirstRWLocation } =+ useCurrentLocationContext();const { getMetadata } = useIOActionsContext();const {currentDirectoryPath,@@ -186,6 +181,7 @@ export const OpenedEntryContextProvider = ({useState<string>(undefined);const firstRender = useFirstRender();const [ignored, forceUpdate] = useReducer((x) => x + 1, 0, undefined);+ const currentLocation = findLocation();/*** Handle openLink from initAppdiff --git a/src/renderer/hooks/PerspectiveSettingsContextProvider.tsx b/src/renderer/hooks/PerspectiveSettingsContextProvider.tsxindex 6bf0308e9..60ea8038a 100644--- a/src/renderer/hooks/PerspectiveSettingsContextProvider.tsx+++ b/src/renderer/hooks/PerspectiveSettingsContextProvider.tsx@@ -86,7 +86,7 @@ export type PerspectiveSettingsContextProviderProps = {export const PerspectiveSettingsContextProvider = ({children,}: PerspectiveSettingsContextProviderProps) => {- const { currentLocation } = useCurrentLocationContext();+ const { findLocation } = useCurrentLocationContext();const {currentDirectoryPath,directoryMeta,@@ -207,8 +207,9 @@ export const PerspectiveSettingsContextProvider = ({perspective: string,folderSettings?: TS.FolderSettings,): Promise<TS.FileSystemEntryMeta> {+ const currentLocation = findLocation();return currentLocation- .loadMetaDataPromise(path)+ ?.loadMetaDataPromise(path).then((fsEntryMeta: TS.FileSystemEntryMeta) => {return {...(fsEntryMeta && fsEntryMeta),diff --git a/src/renderer/hooks/PlatformFacadeContextProvider.tsx b/src/renderer/hooks/PlatformFacadeContextProvider.tsxindex 08eb75b00..4e8030f7e 100644--- a/src/renderer/hooks/PlatformFacadeContextProvider.tsx+++ b/src/renderer/hooks/PlatformFacadeContextProvider.tsx@@ -174,7 +174,7 @@ export const PlatformFacadeContextProvider = ({reflectDeleteEntries,setReflectActions,} = useEditedEntryContext();- const { currentLocation, findLocation } = useCurrentLocationContext();+ const { currentLocationId, findLocation } = useCurrentLocationContext();const { getAllPropertiesPromise } = useDirectoryContentContext();const { ignoreByWatcher, deignoreByWatcher, ignored } = useFSWatcherContext(); //watcher@@ -183,10 +183,7 @@ export const PlatformFacadeContextProvider = ({function getLocation(param: getLocationProps): CommonLocation {const { locationID } = param;- if (locationID) {- return findLocation(locationID);- }- return currentLocation;+ return findLocation(locationID);}function createDirectoryPromise(@@ -195,17 +192,15 @@ export const PlatformFacadeContextProvider = ({reflect: boolean = true,): Promise<any> {ignoreByWatcher(path);-- return getLocation({ locationID })- .createDirectoryPromise(path)- .then((result) => {- if (result !== undefined && reflect) {- // do not reflect if directory not created- reflectAddEntry(currentLocation.toFsEntry(path, false));- }- deignoreByWatcher(path);- return result;- });+ const currentLocation = getLocation({ locationID });+ return currentLocation.createDirectoryPromise(path).then((result) => {+ if (result !== undefined && reflect) {+ // do not reflect if directory not created+ reflectAddEntry(currentLocation.toFsEntry(path, false));+ }+ deignoreByWatcher(path);+ return result;+ });}/**@@ -213,6 +208,7 @@ export const PlatformFacadeContextProvider = ({* return Promise<destThumbPath>*/function setFolderThumbnailPromise(filePath: string): Promise<string> {+ const currentLocation = findLocation();const directoryPath = extractContainingDirectoryPath(filePath,currentLocation?.getDirSeparator(),@@ -744,7 +740,7 @@ export const PlatformFacadeContextProvider = ({deleteEntriesPromise,setFolderThumbnailPromise,};- }, [ignored, currentLocation]); //watcher+ }, [ignored, currentLocationId]); //watcherreturn (<PlatformFacadeContext.Provider value={context}>diff --git a/src/renderer/hooks/SelectedEntryContextProvider.tsx b/src/renderer/hooks/SelectedEntryContextProvider.tsxindex 745a455a2..d93f283da 100644--- a/src/renderer/hooks/SelectedEntryContextProvider.tsx+++ b/src/renderer/hooks/SelectedEntryContextProvider.tsx@@ -49,16 +49,16 @@ export type SelectedEntryContextProviderProps = {export const SelectedEntryContextProvider = ({children,}: SelectedEntryContextProviderProps) => {- const { currentLocation } = useCurrentLocationContext();+ const { currentLocationId } = useCurrentLocationContext();const selectedEntries = useRef<TS.FileSystemEntry[]>([]);const firstRender = useFirstRender();const [ignored, forceUpdate] = useReducer((x) => x + 1, 0, undefined);useEffect(() => {- if (!firstRender && !currentLocation) {+ if (!firstRender && !currentLocationId) {setSelectedEntries([]);}- }, [currentLocation]);+ }, [currentLocationId]);//const lastSelectedEntry = useRef<TS.FileSystemEntry>(undefined);diff --git a/src/renderer/hooks/TaggingActionsContextProvider.tsx b/src/renderer/hooks/TaggingActionsContextProvider.tsxindex 2265eea5a..64851877d 100644--- a/src/renderer/hooks/TaggingActionsContextProvider.tsx+++ b/src/renderer/hooks/TaggingActionsContextProvider.tsx@@ -165,7 +165,7 @@ export const TaggingActionsContextProvider = ({children,}: TaggingActionsContextProviderProps) => {const { t } = useTranslation();- const { findLocation, currentLocation, persistTagsInSidecarFile } =+ const { findLocation, persistTagsInSidecarFile } =useCurrentLocationContext();const { tagGroups, reflectTagLibraryChanged } = useEditedTagLibraryContext();const {@@ -197,6 +197,7 @@ export const TaggingActionsContextProvider = ({const saveTagInLocation: boolean = useSelector(getSaveTagInLocation);const filenameTagPlacedAtEnd = useSelector(getFileNameTagPlace);const [ignored, forceUpdate] = useReducer((x) => x + 1, 0, undefined);+ const currentLocation = findLocation();function addTagsToFilePath(path: string, tags: string[]) {if (tags && tags.length > 0) {diff --git a/src/renderer/perspectives/common/CellView.tsx b/src/renderer/perspectives/common/CellView.tsxindex 5a7b1a1b9..8a55e5f99 100644--- a/src/renderer/perspectives/common/CellView.tsx+++ b/src/renderer/perspectives/common/CellView.tsx@@ -81,7 +81,8 @@ function CellView(props: Props) {const { openEntryInternal, openedEntry } = useOpenedEntryContext();const { openDirectory } = useDirectoryContentContext();const { moveFiles, openFileNatively } = useIOActionsContext();- const { readOnlyMode, currentLocation } = useCurrentLocationContext();+ const { readOnlyMode, currentLocationId, findLocation } =+ useCurrentLocationContext();const { selectedEntries, setSelectedEntries, lastSelectedEntryPath } =useSelectedEntriesContext();const { handleEntryExist, openEntryExistDialog } =@@ -291,10 +292,10 @@ function CellView(props: Props) {handleEntryExist(item.selectedEntries, item.targetPath).then((exist) => {if (exist) {openEntryExistDialog(exist, () => {- moveFiles(arrPath, item.targetPath, currentLocation.uuid);+ moveFiles(arrPath, item.targetPath, currentLocationId);});} else {- moveFiles(arrPath, item.targetPath, currentLocation.uuid);+ moveFiles(arrPath, item.targetPath, currentLocationId);}});}@@ -303,6 +304,7 @@ function CellView(props: Props) {const key = fsEntry.path;if (fsEntry.isFile) {+ const currentLocation = findLocation();return (<div>{nativeDragModeEnabled &&diff --git a/src/renderer/perspectives/grid/components/GridPagination.tsx b/src/renderer/perspectives/grid/components/GridPagination.tsxindex 32f774ad6..0698b0080 100644--- a/src/renderer/perspectives/grid/components/GridPagination.tsx+++ b/src/renderer/perspectives/grid/components/GridPagination.tsx@@ -85,11 +85,12 @@ function GridPagination(props: Props) {showTags,gridPageLimit,} = usePerspectiveSettingsContext();- const { currentLocation } = useCurrentLocationContext();+ const { findLocation } = useCurrentLocationContext();const { directoryMeta } = useDirectoryContentContext();const { sortedDirContent } = useSortedDirContext();const { page, pageFiles, setCurrentPage } = usePaginationContext();const [ignored, forceUpdate] = useReducer((x) => x + 1, 0, undefined);+ const currentLocation = findLocation();const theme = useTheme();const showPagination = sortedDirContent.length !== pageFiles.length;diff --git a/src/renderer/perspectives/grid/components/MainContainer.tsx b/src/renderer/perspectives/grid/components/MainContainer.tsxindex cff578359..718ae83e1 100644--- a/src/renderer/perspectives/grid/components/MainContainer.tsx+++ b/src/renderer/perspectives/grid/components/MainContainer.tsx@@ -62,7 +62,7 @@ function GridPerspective(props: Props) {const { openEntry, openPrevFile, openNextFile } = useOpenedEntryContext();const { actions } = usePerspectiveActionsContext();const { showDirectories } = usePerspectiveSettingsContext();- const { currentLocation } = useCurrentLocationContext();+ const { findLocation } = useCurrentLocationContext();const { openDirectory, currentDirectoryPath } = useDirectoryContentContext();const { openFileNatively, duplicateFile } = useIOActionsContext();const { openDeleteMultipleEntriesDialog } =@@ -193,6 +193,7 @@ function GridPerspective(props: Props) {};const openShareFilesDialog = () => {+ const currentLocation = findLocation();if (currentLocation && currentLocation.haveObjectStoreSupport()) {setIsShareFilesDialogOpened(true);}diff --git a/src/renderer/perspectives/grid/components/MainToolbar.tsx b/src/renderer/perspectives/grid/components/MainToolbar.tsxindex 74fa79504..00e8f75c2 100644--- a/src/renderer/perspectives/grid/components/MainToolbar.tsx+++ b/src/renderer/perspectives/grid/components/MainToolbar.tsx@@ -90,9 +90,10 @@ function MainToolbar(props: Props) {useDirectoryContentContext();const { selectedEntries } = useSelectedEntriesContext();const keyBindings = useSelector(getKeyBindingObject);- const { currentLocation, readOnlyMode } = useCurrentLocationContext();+ const { findLocation, readOnlyMode } = useCurrentLocationContext();const { openDeleteMultipleEntriesDialog } =useDeleteMultipleEntriesDialogContext();+ const currentLocation = findLocation();function showProperties() {return openEntry(currentDirectoryPath, TabNames.propertiesTab);diff --git a/src/renderer/perspectives/list/components/MainContainer.tsx b/src/renderer/perspectives/list/components/MainContainer.tsxindex 0f0f2e030..c8a14267b 100644--- a/src/renderer/perspectives/list/components/MainContainer.tsx+++ b/src/renderer/perspectives/list/components/MainContainer.tsx@@ -62,7 +62,7 @@ function ListPerspective(props: Props) {const { openEntry, openPrevFile, openNextFile } = useOpenedEntryContext();const { actions } = usePerspectiveActionsContext();const { showDirectories } = usePerspectiveSettingsContext();- const { currentLocation } = useCurrentLocationContext();+ const { findLocation } = useCurrentLocationContext();const { openDirectory, currentDirectoryPath } = useDirectoryContentContext();const { openFileNatively, duplicateFile } = useIOActionsContext();const { openDeleteMultipleEntriesDialog } =@@ -193,6 +193,7 @@ function ListPerspective(props: Props) {};const openShareFilesDialog = () => {+ const currentLocation = findLocation();if (currentLocation && currentLocation.haveObjectStoreSupport()) {setIsShareFilesDialogOpened(true);}