Skip to content

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

improving the tag group imports

Ilian Sapundshiev981fd2c7fa9a
diff --git a/app/components/dialogs/ImportExportTagGroupsDialog.js b/app/components/dialogs/ImportExportTagGroupsDialog.js
index 0ff5587c9..4473227a3 100644
--- a/app/components/dialogs/ImportExportTagGroupsDialog.js
+++ b/app/components/dialogs/ImportExportTagGroupsDialog.js
@@ -76,18 +76,20 @@ class ImportExportTagGroupsDialog extends React.Component<Props, State> {
if (nextProps.open === true) {
const tagGroupList = [];
const tagGroups = nextProps.tagGroups;
- tagGroups.map(entry => {
- tagGroupList.push({
- uuid: entry.uuid || entry.key,
- title: entry.title,
- color: entry.color,
- textcolor: entry.textcolor,
- children: entry.children,
- expanded: entry.expanded,
- selected: true
+ if (tagGroups) {
+ tagGroups.map(entry => {
+ tagGroupList.push({
+ uuid: entry.uuid || entry.key,
+ title: entry.title,
+ color: entry.color,
+ textcolor: entry.textcolor,
+ children: entry.children,
+ expanded: entry.expanded,
+ selected: true
+ });
});
- });
- this.setState({ tagGroupList, selectedAll: true }, this.handleValidation);
+ this.setState({ tagGroupList, selectedAll: true }, this.handleValidation);
+ }
}
};
diff --git a/app/components/menus/TagLibraryMenu.js b/app/components/menus/TagLibraryMenu.js
index 20ed1722e..dd7a25100 100644
--- a/app/components/menus/TagLibraryMenu.js
+++ b/app/components/menus/TagLibraryMenu.js
@@ -89,8 +89,8 @@ const TagLibraryMenu = (props: Props) => {
try {
const jsonObj = JSON.parse(reader.result);
if (jsonObj.tagGroups) {
- setIsImportExportTagGroupDialogOpened(true);
setTagGroups(jsonObj.tagGroups);
+ setIsImportExportTagGroupDialogOpened(true);
} else {
// TODO connect showNotification
/* props.showNotification(