fix: remove recursive tag deletion
This commit is contained in:
@@ -198,15 +198,9 @@ export class NoteTagsState {
|
|||||||
async removeTagFromActiveNote(tag: SNTag): Promise<void> {
|
async removeTagFromActiveNote(tag: SNTag): Promise<void> {
|
||||||
const { activeNote } = this;
|
const { activeNote } = this;
|
||||||
if (activeNote) {
|
if (activeNote) {
|
||||||
const descendantTags = this.application.getTagDescendants(tag);
|
await this.application.changeItem(tag.uuid, (mutator) => {
|
||||||
const tagsToRemove = [...descendantTags, tag];
|
mutator.removeItemAsRelationship(activeNote);
|
||||||
await Promise.all(
|
});
|
||||||
tagsToRemove.map(async (tag) => {
|
|
||||||
await this.application.changeItem(tag.uuid, (mutator) => {
|
|
||||||
mutator.removeItemAsRelationship(activeNote);
|
|
||||||
});
|
|
||||||
})
|
|
||||||
);
|
|
||||||
this.application.sync();
|
this.application.sync();
|
||||||
this.reloadTags();
|
this.reloadTags();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -346,17 +346,11 @@ export class NotesState {
|
|||||||
|
|
||||||
async removeTagFromSelectedNotes(tag: SNTag): Promise<void> {
|
async removeTagFromSelectedNotes(tag: SNTag): Promise<void> {
|
||||||
const selectedNotes = Object.values(this.selectedNotes);
|
const selectedNotes = Object.values(this.selectedNotes);
|
||||||
const descendantTags = this.application.getTagDescendants(tag);
|
await this.application.changeItem(tag.uuid, (mutator) => {
|
||||||
const tagsToRemove = [...descendantTags, tag];
|
for (const note of selectedNotes) {
|
||||||
await Promise.all(
|
mutator.removeItemAsRelationship(note);
|
||||||
tagsToRemove.map(async (tag) => {
|
}
|
||||||
await this.application.changeItem(tag.uuid, (mutator) => {
|
});
|
||||||
for (const note of selectedNotes) {
|
|
||||||
mutator.removeItemAsRelationship(note);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})
|
|
||||||
);
|
|
||||||
this.application.sync();
|
this.application.sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user