refactor: add tag method

Co-authored-by: Baptiste Grob <60621355+baptiste-grob@users.noreply.github.com>
This commit is contained in:
Antonella Sgarlatta
2021-05-07 19:12:35 -03:00
committed by GitHub
parent 461f3ccfa4
commit 3906b9a9b4

View File

@@ -38,14 +38,11 @@ export class TagsState {
const selectedNotes = Object.values(
this.application.getAppState().notes.selectedNotes
);
await Promise.all(
selectedNotes.map(
async (note) =>
await this.application.changeItem(tag.uuid, (mutator) => {
mutator.addItemAsRelationship(note);
})
)
);
await this.application.changeItem(tag.uuid, (mutator) => {
for (const note of selectedNotes) {
mutator.addItemAsRelationship(note);
}
});
this.application.sync();
}