Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions frontend/src/ts/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,15 @@ export async function saveLocalTagPB<M extends Mode>(
return;
}

export function deleteLocalTag(tagId: string): void {
getSnapshot()?.results?.forEach((result) => {
const tagIndex = result.tags.indexOf(tagId);
if (tagIndex > -1) {
result.tags.splice(tagIndex, 1);
}
});
}

export async function updateLocalTagPB<M extends Mode>(
tagId: string,
mode: M,
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/ts/modals/edit-tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,10 @@ const actionModals: Record<Action, SimpleModal> = {
snapshot.tags = snapshot.tags.filter((it) => it._id !== tagId);
}

DB.deleteLocalTag(tagId);

void Settings.update();

return { status: 1, message: `Tag removed` };
},
}),
Expand Down