mobile: fix note assigned to multiple colors

This commit is contained in:
Ammar Ahmed
2024-02-28 12:49:41 +05:00
committed by Abdullah Atta
parent 8089f7e181
commit cd62069b9b

View File

@@ -51,7 +51,15 @@ const ColorItem = ({ item, note }: { item: Color; note: Note }) => {
}, [item, note.id]);
const toggleColor = async () => {
await db.relations.unlinkOfType("color", [item.id]);
await db.relations
.to(
{
type: "note",
id: note.id
},
"color"
)
.unlink();
if (!isLinked) {
await db.relations.add(item, note);