From 6bf14512f9fecafb602754c646a29a16ffcbb31c Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Mon, 17 Oct 2022 22:38:50 +0500 Subject: [PATCH] core: fix `cannot read property title of undefined` --- packages/core/collections/notes.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/collections/notes.js b/packages/core/collections/notes.js index e3690ff51..2f6445c9c 100644 --- a/packages/core/collections/notes.js +++ b/packages/core/collections/notes.js @@ -264,8 +264,8 @@ export default class Notes extends Collection { const { color, tags, id } = note; if (color) { - const { title } = await this._db.colors.add(color, id); - note.color = title; + const addedColor = await this._db.colors.add(color, id); + if (addedColor) note.color = addedColor.title; } if (tags && tags.length) {