Skip to content

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

fix: diable changing folder while loading folder content

Ilian Sapundshievf9c5f6cf3875
diff --git a/app/components/FolderContainer.tsx b/app/components/FolderContainer.tsx
index 575540290..9420433a6 100644
--- a/app/components/FolderContainer.tsx
+++ b/app/components/FolderContainer.tsx
@@ -43,6 +43,7 @@ import {
getDirectoryContent,
getSearchResultCount,
isReadOnlyMode,
+ isLoading,
getCurrentLocationPath,
getCurrentDirectoryPerspective,
OpenedEntry,
@@ -65,6 +66,7 @@ import {
getSearchQuery
} from '-/reducers/location-index';
import Links from '-/links';
+import PlatformIO from '-/services/platform-facade';
const GridPerspective = React.lazy(() =>
import(
@@ -178,6 +180,7 @@ interface Props {
loadParentDirectoryContent: () => void;
setSelectedEntries: (selectedEntries: Array<Object>) => void;
isReadOnlyMode: boolean;
+ isLoading: boolean;
isDesktopMode: boolean;
showNotification: (content: string) => void;
toggleDrawer?: () => void;
@@ -383,7 +386,8 @@ const FolderContainer = (props: Props) => {
setSelectedEntries,
openDirectory,
reflectCreateEntry,
- openFsEntry
+ openFsEntry,
+ isLoading
} = props;
/* let searchResultCounterText = searchResultCount + ' ' + i18n.t('entries');
@@ -574,6 +578,18 @@ const FolderContainer = (props: Props) => {
width: '100%'
}}
>
+ {isLoading && PlatformIO.haveObjectStoreSupport() && (
+ <div
+ style={{
+ position: 'absolute',
+ zIndex: 1000,
+ height: '100%',
+ width: '100%',
+ backdropFilter: 'blur(2px)',
+ backgroundColor: '#fafafaAA' // red: '#eb585882' '#d9d9d980'
+ }}
+ ></div>
+ )}
{renderPerspective()}
{isRenameEntryDialogOpened && (
<RenameEntryDialog
@@ -650,7 +666,8 @@ function mapStateToProps(state) {
isDesktopMode: getDesktopMode(state),
isReadOnlyMode: isReadOnlyMode(state),
progress: getProgress(state),
- searchQuery: getSearchQuery(state)
+ searchQuery: getSearchQuery(state),
+ isLoading: isLoading(state)
};
}
@@ -684,6 +701,7 @@ function mapActionCreatorsToProps(dispatch) {
const areEqual = (prevProp: Props, nextProp: Props) =>
// nextProp.rightPanelWidth === prevProp.rightPanelWidth &&
+ nextProp.isLoading === prevProp.isLoading &&
nextProp.settings.currentTheme === prevProp.settings.currentTheme &&
nextProp.drawerOpened === prevProp.drawerOpened &&
nextProp.isDesktopMode === prevProp.isDesktopMode &&
diff --git a/app/components/LocationManager.tsx b/app/components/LocationManager.tsx
index 4d91831a1..d698c3ddc 100644
--- a/app/components/LocationManager.tsx
+++ b/app/components/LocationManager.tsx
@@ -29,7 +29,7 @@ import {
actions as LocationActions,
getLocations
} from '../reducers/locations';
-import { actions as AppActions } from '../reducers/app';
+import { actions as AppActions, isLoading } from '../reducers/app';
import {
getPersistTagsInSidecarFile,
isDesktopMode
@@ -40,6 +40,7 @@ import LoadingLazy from '-/components/LoadingLazy';
import LocationView from '-/components/LocationView';
import { Pro } from '-/pro';
import { TS } from '-/tagspaces.namespace';
+import PlatformIO from '-/services/platform-facade';
const CreateEditLocationDialog = React.lazy(() =>
import(
@@ -68,6 +69,7 @@ interface Props {
isPersistTagsInSidecar: boolean;
reduceHeightBy: number;
toggleLocationDialog: () => void;
+ isLoading: boolean;
}
type SubFolder = {
@@ -122,7 +124,7 @@ const LocationManager = (props: Props) => {
props.moveLocation(result.draggableId, result.destination.index);
};
- const { classes, reduceHeightBy } = props;
+ const { classes, reduceHeightBy, isLoading } = props;
return (
<div
className={classes.panel}
@@ -131,6 +133,20 @@ const LocationManager = (props: Props) => {
flexDirection: 'column'
}}
>
+ {isLoading && PlatformIO.haveObjectStoreSupport() && (
+ <div
+ style={{
+ position: 'absolute',
+ zIndex: 1000,
+ height: '100%',
+ width: '100%',
+ backdropFilter: 'blur(2px)',
+ backgroundColor: '#fafafaAA' // red: '#eb585882' '#d9d9d980'
+ }}
+ >
+ Loading...
+ </div>
+ )}
<LocationManagerMenu
importLocations={() => {
fileInputRef.current.click();
@@ -258,6 +274,7 @@ function mapStateToProps(state) {
return {
locations: getLocations(state),
isDesktop: isDesktopMode(state),
+ isLoading: isLoading(state),
isPersistTagsInSidecar: getPersistTagsInSidecarFile(state)
};
}
diff --git a/app/reducers/app.ts b/app/reducers/app.ts
index f1e74f6f2..ec949e376 100644
--- a/app/reducers/app.ts
+++ b/app/reducers/app.ts
@@ -117,7 +117,8 @@ export const types = {
REFLECT_CREATE_ENTRY: 'APP/REFLECT_CREATE_ENTRY',
// REFLECT_UPDATE_SIDECARTAGS: 'APP/REFLECT_UPDATE_SIDECARTAGS',
// REFLECT_UPDATE_SIDECARMETA: 'APP/REFLECT_UPDATE_SIDECARMETA',
- UPDATE_CURRENTDIR_ENTRY: 'APP/UPDATE_CURRENTDIR_ENTRY'
+ UPDATE_CURRENTDIR_ENTRY: 'APP/UPDATE_CURRENTDIR_ENTRY',
+ SET_ISLOADING: 'APP/SET_ISLOADING'
};
export const perspectives = {
DEFAULT: 'default',
@@ -436,6 +437,12 @@ export default (state: any = initialState, action: any) => {
}
};
}
+ case types.SET_ISLOADING: {
+ return {
+ ...state,
+ isLoading: action.isLoading
+ };
+ }
case types.SET_GENERATING_THUMBNAILS: {
return {
...state,
@@ -883,6 +890,10 @@ export const actions = {
openSearchPanel: () => ({ type: types.OPEN_SEARCH_PANEL }),
openHelpFeedbackPanel: () => ({ type: types.OPEN_HELPFEEDBACK_PANEL }),
closeAllVerticalPanels: () => ({ type: types.CLOSE_ALLVERTICAL_PANELS }),
+ setIsLoading: (isLoading: boolean) => ({
+ type: types.SET_ISLOADING,
+ isLoading
+ }),
loadParentDirectoryContent: () => (
dispatch: (actions: Object) => void,
getState: () => any
@@ -891,6 +902,8 @@ export const actions = {
const { currentDirectoryPath } = state.app;
const currentLocationPath = normalizePath(getCurrentLocationPath(state));
+ dispatch(actions.setIsLoading(true));
+
if (currentDirectoryPath) {
const parentDirectory = extractParentDirectoryPath(
currentDirectoryPath,
@@ -971,6 +984,8 @@ export const actions = {
// console.debug('loadDirectoryContent:' + directoryPath);
window.walkCanceled = false;
+ dispatch(actions.setIsLoading(true));
+
const state = getState();
const { selectedEntries } = state.app;
if (selectedEntries.length > 0) {