TagSpaces is an offline, open source, document manager with tagging support
Fix TagContainer not updating correctly
HappyDay3a59c48f49fe
diff --git a/app/components/TagContainer.js b/app/components/TagContainer.jsindex c88e4cf85..8c032adcf 100644--- a/app/components/TagContainer.js+++ b/app/components/TagContainer.js@@ -45,11 +45,26 @@ 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+ if (this.props.tag.title !== nextProps.tag.title+ || typeof this.props.key !== typeof nextProps.key+ || (this.props.key && nextProps.key && this.props.key !== nextProps.key)+ || this.props.tag.color !== nextProps.tag.color+ || this.props.tag.textcolor !== nextProps.tag.textcolor+ || this.props.allTags.some((currentTag: Tag) => {+ if (currentTag.title === this.props.tag.title) {+ return (nextProps.allTags.some((updatedTag: Tag) => {+ if (updatedTag.title === this.props.tag.title) {+ return currentTag.color !== updatedTag.color || currentTag.textcolor !== updatedTag.textcolor;+ }+ return false;+ }));+ }+ return false;+ })+ || (this.props.tagGroup && this.props.tagGroup ? (this.props.tagGroup.uuid !== nextProps.tagGroup.uuid) : false)|| this.props.isDragging !== nextProps.isDragging- || this.props.entryPath !== nextProps.entryPath+ || typeof this.props.entryPath !== typeof nextProps.entryPath+ || (this.props.entryPath && this.props.entryPath !== nextProps.entryPath)) {return true;}diff --git a/app/components/TagContainerDnd.js b/app/components/TagContainerDnd.jsindex feff5a9c3..1cfcbf516 100644--- a/app/components/TagContainerDnd.js+++ b/app/components/TagContainerDnd.js@@ -81,11 +81,15 @@ class TagContainerDnd extends React.Component<Props> {}shouldComponentUpdate(nextProps) {- if (this.props.tag !== nextProps.tag- || this.props.key !== nextProps.key- || this.props.tagGroup !== nextProps.tagGroup+ if (this.props.tag.title !== nextProps.tag.title+ || typeof this.props.key !== typeof nextProps.key+ || (this.props.key && nextProps.key && this.props.key !== nextProps.key)+ || this.props.tag.color !== nextProps.tag.color+ || this.props.tag.textcolor !== nextProps.tag.textcolor+ || (this.props.tagGroup && this.props.tagGroup ? (this.props.tagGroup.uuid !== nextProps.tagGroup.uuid) : false)|| this.props.isDragging !== nextProps.isDragging- || this.props.entryPath !== nextProps.entryPath+ || typeof this.props.entryPath !== typeof nextProps.entryPath+ || (this.props.entryPath && this.props.entryPath !== nextProps.entryPath)) {return true;}