Skip to content

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

fix: issue with tag group creation

Ilian Sapundshievc5cfbd60b505
diff --git a/app/components/dialogs/CreateTagGroupDialog.tsx b/app/components/dialogs/CreateTagGroupDialog.tsx
index 5131643dc..5e0aaff33 100644
--- a/app/components/dialogs/CreateTagGroupDialog.tsx
+++ b/app/components/dialogs/CreateTagGroupDialog.tsx
@@ -47,7 +47,7 @@ interface Props {
textcolor: string;
currentLocationId: string | null;
locations: Array<TS.Location>;
- saveTagInLocation: boolean;
+ saveTagsInLocation: boolean;
}
const defaultTagGroupLocation = 'TAG_LIBRARY';
@@ -67,6 +67,14 @@ const CreateTagGroupDialog = (props: Props) => {
// eslint-disable-next-line no-unused-vars
const [ignored, forceUpdate] = useReducer(x => x + 1, 0);
+ const {
+ fullScreen,
+ open,
+ saveTagsInLocation,
+ onClose,
+ createTagGroup
+ } = props;
+
const handleTagGroupTitleChange = (
event: React.ChangeEvent<HTMLInputElement>
) => {
@@ -100,19 +108,21 @@ const CreateTagGroupDialog = (props: Props) => {
};
const onConfirm = () => {
+ let lId;
+ if (saveTagsInLocation && locationId.current !== defaultTagGroupLocation) {
+ lId = locationId.current;
+ }
+
if (!disableConfirmButton.current) {
- props.createTagGroup({
+ createTagGroup({
uuid: uuidv1(),
title: title.current,
color: color.current,
textcolor: textcolor.current,
- locationId:
- locationId.current === defaultTagGroupLocation
- ? undefined
- : locationId.current,
+ locationId: lId,
children: []
});
- props.onClose();
+ onClose();
}
};
@@ -132,8 +142,6 @@ const CreateTagGroupDialog = (props: Props) => {
textcolor.current = value;
};
- const { fullScreen, open, onClose } = props;
-
const styles = {
color: {
width: '100%',
@@ -206,7 +214,7 @@ const CreateTagGroupDialog = (props: Props) => {
</FormHelperText>
)}
</FormControl>
- {props.saveTagInLocation && (
+ {props.saveTagsInLocation && (
<FormControl fullWidth={true} error={inputError}>
<FormHelperText style={styles.helpText}>
{i18n.t('core:tagGroupLocation')}
@@ -301,7 +309,7 @@ function mapStateToProps(state) {
return {
locations: getLocations(state),
currentLocationId: getCurrentLocationId(state),
- saveTagInLocation: state.settings.saveTagInLocation
+ saveTagsInLocation: state.settings.saveTagInLocation
};
}