1
0
Fork 0
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:
Fedor Katurov 2021-09-28 16:20:16 +07:00
parent 04a7b28a53
commit f12f952b37
2 changed files with 8 additions and 1 deletions

View file

@ -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]
); );

View file

@ -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 {}
} }