TagSpaces is an offline, open source, document manager with tagging support
clear folder content on directory change
Ilian Sapundshievb4f12dd6fda4
diff --git a/app/perspectives/grid-perspective/src/index.js b/app/perspectives/grid-perspective/src/index.jsindex d29c4b362..6e165eef2 100644--- a/app/perspectives/grid-perspective/src/index.js+++ b/app/perspectives/grid-perspective/src/index.js@@ -89,6 +89,7 @@ import IOActions from '../../../reducers/io-actions';import {actions as AppActions,getLastSelectedEntry,+ isLoading} from '../../../reducers/app';const maxDescriptionPreviewLength = 100;@@ -99,6 +100,7 @@ type Props = {classes: Object,currentDirectoryPath: string,lastSelectedEntryPath: string | null,+ isAppLoading: boolean,openFile: (path: string, isFile?: boolean) => void,deleteFile: (path: string) => void,deleteDirectory: (path: string) => void,@@ -830,11 +832,11 @@ class GridPerspective extends React.Component<Props, State> {};render() {- const classes = this.props.classes;+ const { classes, isAppLoading, directoryContent } = this.props;const { selectedEntries = [], layoutType, entrySize, sortBy, orderBy } = this.state;const selectedFilePaths = selectedEntries.filter(fsEntry => fsEntry.isFile).map(fsentry => fsentry.path);- const sortedContent = this.sort(this.props.directoryContent, sortBy, orderBy);+ const sortedContent = this.sort(directoryContent, sortBy, orderBy);const sortedDirectories = sortedContent.filter(entry => !entry.isFile);const sortedFiles = sortedContent.filter(entry => entry.isFile);let entryWidth = 200;@@ -961,7 +963,12 @@ class GridPerspective extends React.Component<Props, State> {>{(sortedDirectories.map(entry => this.renderCell(entry)))}{(sortedFiles.map(entry => this.renderCell(entry)))}- {(sortedFiles.length < 1 && sortedDirectories.length < 1) && (+ {isAppLoading && (+ <Typography style={{ padding: 15 }}>+ {i18n.t('core:loading')}+ </Typography>+ )}+ {(!isAppLoading && sortedFiles.length < 1 && sortedDirectories.length < 1) && (<Typography style={{ padding: 15 }}>{i18n.t('core:noFileFolderFound')}</Typography>@@ -1213,6 +1220,7 @@ function mapActionCreatorsToProps(dispatch) {function mapStateToProps(state) {return {supportedFileTypes: getSupportedFileTypes(state),+ isAppLoading: isLoading(state),lastSelectedEntryPath: getLastSelectedEntry(state),};}diff --git a/app/reducers/app.js b/app/reducers/app.jsindex dcbf34327..41dae4925 100644--- a/app/reducers/app.js+++ b/app/reducers/app.js@@ -159,7 +159,7 @@ export default (state: Object = initialState, action: Object) => {...state,currentDirectoryEntries: action.directoryContent,currentDirectoryPath: action.directoryPath,- isLoading: false+ isLoading: action.showIsLoading || false};}case types.CLEAR_DIRECTORY_CONTENT: {@@ -570,6 +570,7 @@ export const actions = {console.time('listDirectoryPromise');const { settings } = getState();window.walkCanceled = false;+ dispatch(actions.loadDirectorySuccessInt(directoryPath, [], true));dispatch(actions.showNotification(i18n.t('core:loading'), 'info', false));PlatformIO.listDirectoryPromise(directoryPath, false).then(results => {@@ -666,11 +667,13 @@ export const actions = {},loadDirectorySuccessInt: (directoryPath: string,- directoryContent: Array<Object>+ directoryContent: Array<Object>,+ showIsLoading: boolean) => ({type: types.LOAD_DIRECTORY_SUCCESS,directoryPath,- directoryContent+ directoryContent,+ showIsLoading}),loadDirectoryFailure: (directoryPath: string, error: any) => (dispatch: (actions: Object) => void@@ -1392,3 +1395,4 @@ export const getSearchResults = (state: Object) => state.app.currentDirectoryEntexport const getSearchResultCount = (state: Object) => state.app.currentDirectoryEntries.length;export const getCurrentLocationId = (state: Object) => state.app.currentLocationId;export const isEntryInFullWidth = (state: Object) => state.app.isEntryInFullWidth;+export const isLoading = (state: Object) => state.app.isLoading;