mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
skipping tag update on empty tags
This commit is contained in:
parent
04a7b28a53
commit
f12f952b37
2 changed files with 8 additions and 1 deletions
|
@ -35,7 +35,13 @@ export const Tags: FC<IProps> = ({
|
||||||
}
|
}
|
||||||
|
|
||||||
const exist = tags.map(tag => tag.title);
|
const exist = tags.map(tag => tag.title);
|
||||||
onTagsChange(uniq([...exist, ...data, ...last]).filter(el => el) as string[]);
|
const uniqueTags = uniq([...exist, ...data, ...last]).filter(el => el) as string[];
|
||||||
|
|
||||||
|
if (uniqueTags.length === exist.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
onTagsChange(uniqueTags);
|
||||||
},
|
},
|
||||||
[data]
|
[data]
|
||||||
);
|
);
|
||||||
|
|
|
@ -252,6 +252,7 @@ function* onDeleteTag({ id, tagId }: ReturnType<typeof nodeDeleteTag>) {
|
||||||
try {
|
try {
|
||||||
const { tags }: Unwrap<typeof apiDeleteNodeTag> = yield call(apiDeleteNodeTag, { id, tagId });
|
const { tags }: Unwrap<typeof apiDeleteNodeTag> = yield call(apiDeleteNodeTag, { id, tagId });
|
||||||
yield put(nodeSetTags(tags));
|
yield put(nodeSetTags(tags));
|
||||||
|
yield call(nodeGetRelated, id);
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue