From aa814fcec65d8ce101f5a4d59b573ba7d039aff0 Mon Sep 17 00:00:00 2001 From: ammarahm-ed Date: Sat, 31 Oct 2020 13:29:36 +0500 Subject: [PATCH] fix syncing from note menu --- .../src/components/ActionSheetComponent/index.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/mobile/src/components/ActionSheetComponent/index.js b/apps/mobile/src/components/ActionSheetComponent/index.js index 16d23ee3a..3723aa1f5 100644 --- a/apps/mobile/src/components/ActionSheetComponent/index.js +++ b/apps/mobile/src/components/ActionSheetComponent/index.js @@ -595,20 +595,23 @@ export const ActionSheetComponent = ({ ); return; } - if (user?.lastSynced < note?.dateEdited) { + if (user?.lastSynced < note?.dateEdited || !user.lastSynced) { setRefreshing(true); try { - let user = await db.user.get(); - dispatch({type: Actions.USER, user: user}); await db.sync(); localRefresh(); ToastEvent.show('Note synced', 'success', 'local'); } catch (e) { ToastEvent.show(e.message, 'error', 'local'); } finally { + let user = await db.user.get(); + dispatch({type: Actions.USER, user: user}); + dispatch({type: Actions.ALL}); setRefreshing(false); } - dispatch({type: Actions.ALL}); + + } else { + console.log('here',user?.lastSynced,user?.lastSynced < note?.dateEdited) } };