Skip to content

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

feat: cache monograph ids array

thecodrrce1f1ac7f527
diff --git a/packages/core/api/monographs.js b/packages/core/api/monographs.js
index 26b238a63..85b448004 100644
--- a/packages/core/api/monographs.js
+++ b/packages/core/api/monographs.js
@@ -15,11 +15,13 @@ class Monographs {
const user = await this._db.user.getUser();
const token = await this._db.user.tokenManager.getAccessToken();
if (!user || !token || !user.isEmailConfirmed) return;
+ this.monographs = await this._db.context.read("monographs", true);
try {
this.monographs = await http.get(
`${Constants.API_HOST}/monographs`,
token
);
+ await this._db.context.write("monographs", this.monographs);
} catch (e) {
console.error(e);
}