Skip to content

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

performance optimizations related to the alltags prop

Ilian Sapundshieva422a81092f6
diff --git a/app/components/FolderContainer.js b/app/components/FolderContainer.js
index 824377782..15ae35048 100644
--- a/app/components/FolderContainer.js
+++ b/app/components/FolderContainer.js
@@ -48,7 +48,7 @@ import {
isReadOnlyMode
} from '../reducers/app';
import TaggingActions from '../reducers/tagging-actions';
-import { getAllTags, type Tag } from '../reducers/taglibrary';
+import { type Tag } from '../reducers/taglibrary';
import { extractDirectoryName } from '../utils/paths';
// https://reactjs.org/blog/2017/05/18/whats-new-in-create-react-app.html#code-splitting-with-dynamic-import
@@ -134,7 +134,6 @@ type Props = {
currentDirectoryPath: string | null,
searchResultCount: number,
lastSelectedEntry: string | null,
- allTags: Array<Tag>,
settings: Object,
addTags: () => void,
removeTags: () => void,
@@ -301,7 +300,6 @@ class FolderContainer extends React.Component<Props, State> {
addTags={this.props.addTags}
editTagForEntry={this.props.editTagForEntry}
deleteDirectory={this.props.deleteDirectory}
- allTags={this.props.allTags}
settings={this.props.settings}
removeTags={this.props.removeTags}
removeAllTags={this.props.removeAllTags}
@@ -324,7 +322,6 @@ class FolderContainer extends React.Component<Props, State> {
setLastSelectedEntry={this.props.setLastSelectedEntry}
perspectiveCommand={this.state.perspectiveCommand}
deleteDirectory={this.props.deleteDirectory}
- tags={this.props.allTags}
settings={this.props.settings}
addTags={this.props.addTags}
removeTags={this.props.removeTags}
@@ -438,7 +435,6 @@ function mapStateToProps(state) {
currentLocationId: getCurrentLocationId(state),
perspectives: getPerspectives(state),
directoryContent: getDirectoryContent(state),
- allTags: getAllTags(state),
searchResultCount: getSearchResultCount(state),
isReadOnlyMode: isReadOnlyMode(state),
settings: state.settings
diff --git a/app/components/dialogs/AddRemoveTagsDialog.js b/app/components/dialogs/AddRemoveTagsDialog.js
index a6f4e337a..3bacd13e3 100644
--- a/app/components/dialogs/AddRemoveTagsDialog.js
+++ b/app/components/dialogs/AddRemoveTagsDialog.js
@@ -18,12 +18,13 @@
*/
import React, { Component } from 'react';
+import { connect } from 'react-redux';
import Button from '@material-ui/core/Button';
import DialogActions from '@material-ui/core/DialogActions';
import DialogContent from '@material-ui/core/DialogContent';
import DialogTitle from '@material-ui/core/DialogTitle';
import GenericDialog from './GenericDialog';
-import { type Tag } from '../../reducers/taglibrary';
+import { type Tag, getAllTags } from '../../reducers/taglibrary';
import TagAutosuggestion from '../TagAutosuggestion/';
import i18n from '../../services/i18n';
import ConfirmDialog from '../dialogs/ConfirmDialog';
@@ -220,4 +221,10 @@ class AddRemoveTagsDialog extends React.Component<Props, State> {
}
}
-export default AddRemoveTagsDialog;
+function mapStateToProps(state) {
+ return {
+ allTags: getAllTags(state),
+ };
+}
+
+export default connect(mapStateToProps)(AddRemoveTagsDialog);
diff --git a/app/components/dialogs/MoveCopyFilesDialog.js b/app/components/dialogs/MoveCopyFilesDialog.js
index 7a6487b08..f6ecaf680 100644
--- a/app/components/dialogs/MoveCopyFilesDialog.js
+++ b/app/components/dialogs/MoveCopyFilesDialog.js
@@ -23,7 +23,6 @@ import { connect } from 'react-redux';
import Button from '@material-ui/core/Button';
import ListItemText from '@material-ui/core/ListItemText';
import Input from '@material-ui/core/Input';
-import InputLabel from '@material-ui/core/InputLabel';
import InputAdornment from '@material-ui/core/InputAdornment';
import IconButton from '@material-ui/core/IconButton';
import FolderIcon from '@material-ui/icons/Folder';
diff --git a/app/perspectives/grid-perspective/src/index.js b/app/perspectives/grid-perspective/src/index.js
index de8e57ec7..58440f08a 100644
--- a/app/perspectives/grid-perspective/src/index.js
+++ b/app/perspectives/grid-perspective/src/index.js
@@ -222,7 +222,6 @@ type Props = {
removeTags: () => void,
removeAllTags: () => void,
editTagForEntry: () => void,
- allTags: Array<Tag>,
perspectiveCommand: Object,
settings: Object,
directoryContent: Array<FileSystemEntry>
@@ -1073,7 +1072,6 @@ class GridPerspective extends React.Component<Props, State> {
addTags={this.props.addTags}
removeTags={this.props.removeTags}
removeAllTags={this.props.removeAllTags}
- allTags={this.props.allTags}
/>
<MoveCopyFilesDialog
open={this.state.isMoveCopyFilesDialogOpened}