Skip to content

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

Improve TagContainer performance

HappyDay570c44b9ba89
diff --git a/app/components/TagContainer.js b/app/components/TagContainer.js
index 31c40665e..c88e4cf85 100644
--- a/app/components/TagContainer.js
+++ b/app/components/TagContainer.js
@@ -44,6 +44,18 @@ type Props = {
class TagContainer extends React.Component<Props> {
+ shouldComponentUpdate(nextProps) {
+ if (this.props.tag !== nextProps.tag
+ || this.props.key !== nextProps.key
+ || this.props.tagGroup !== nextProps.tagGroup
+ || this.props.isDragging !== nextProps.isDragging
+ || this.props.entryPath !== nextProps.entryPath
+ ) {
+ return true;
+ }
+ return false;
+ }
+
render() {
const {
key,
diff --git a/app/components/TagContainerDnd.js b/app/components/TagContainerDnd.js
index bc617b7bd..feff5a9c3 100644
--- a/app/components/TagContainerDnd.js
+++ b/app/components/TagContainerDnd.js
@@ -80,6 +80,18 @@ class TagContainerDnd extends React.Component<Props> {
// this.props.connectDragPreview(getEmptyImage(), { captureDraggingState: true });
}
+ shouldComponentUpdate(nextProps) {
+ if (this.props.tag !== nextProps.tag
+ || this.props.key !== nextProps.key
+ || this.props.tagGroup !== nextProps.tagGroup
+ || this.props.isDragging !== nextProps.isDragging
+ || this.props.entryPath !== nextProps.entryPath
+ ) {
+ return true;
+ }
+ return false;
+ }
+
render() {
const {
key,