Skip to content

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

fix: send attachmentsLoading event for single item op

thecodrr71f7e25a1788
diff --git a/packages/core/api/index.js b/packages/core/api/index.js
index 91dcef219..375da43ee 100644
--- a/packages/core/api/index.js
+++ b/packages/core/api/index.js
@@ -54,6 +54,7 @@ class Database {
this.connectSSE.bind(this)
);
EV.subscribe(EVENTS.attachmentDeleted, async (attachment) => {
+ console.log("deleted:", attachment);
await this.fs.cancel(attachment.metadata.hash);
});
EV.subscribe(EVENTS.userLoggedOut, async () => {
diff --git a/packages/core/common.js b/packages/core/common.js
index 57a673e5a..abdc554a0 100644
--- a/packages/core/common.js
+++ b/packages/core/common.js
@@ -14,7 +14,7 @@ export async function sendAttachmentsProgressEvent(type, total, current) {
EV.publish(EVENTS.attachmentsLoading, {
type,
total,
- current: current || total,
+ current: current === undefined ? total : current,
});
}