Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: simplify getting notebook total notes count

Abdullah Atta67000f9b38d8
diff --git a/apps/web/src/common/index.js b/apps/web/src/common/index.js
index c3565e51e..c789fa23c 100644
--- a/apps/web/src/common/index.js
+++ b/apps/web/src/common/index.js
@@ -142,10 +142,7 @@ export async function restoreBackupFile(backup) {
}
export function getTotalNotes(notebook) {
- return notebook.topics.reduce((sum, topic) => {
- if (!topic || !topic.notes) return sum;
- return sum + topic.notes.length;
- }, 0);
+ return db.notebooks.notebook(notebook)?.totalNotes;
}
export async function verifyAccount() {