From 24c899e7093ecf754e102ce75bfaaca922bd7f83 Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Tue, 28 Feb 2023 12:10:51 +0500 Subject: [PATCH] web: ensure that images get downloaded on realtime sync --- apps/web/src/components/editor/index.tsx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/apps/web/src/components/editor/index.tsx b/apps/web/src/components/editor/index.tsx index cdd7759fb..1d4ae33cb 100644 --- a/apps/web/src/components/editor/index.tsx +++ b/apps/web/src/components/editor/index.tsx @@ -119,13 +119,17 @@ export default function EditorManager({ editorInstance.current?.updateContent(item.data as string); - db.eventManager.subscribe( - EVENTS.syncCompleted, - async () => { - await db.attachments?.downloadMedia(id); - }, - true - ); + if (appstore.get().isSyncing()) { + db.eventManager.subscribe( + EVENTS.syncCompleted, + async () => { + await db.attachments?.downloadMedia(id); + }, + true + ); + } else { + await db.attachments?.downloadMedia(id); + } } else if (isNote) { if (!locked && item.locked) return EV.publish(EVENTS.vaultLocked);