feat: don't wait for sync to finish after auth success

This commit is contained in:
thecodrr
2021-11-15 10:33:55 +05:00
parent a286ef69c3
commit 71d699b4e6
4 changed files with 16 additions and 15 deletions

View File

@@ -24,6 +24,7 @@ if (process.env.NODE_ENV === "production") {
export default function AppEffects({ setShow }) {
const refreshColors = useStore((store) => store.refreshColors);
const sync = useStore((store) => store.sync);
const refreshMenuPins = useStore((store) => store.refreshMenuPins);
const updateLastSynced = useStore((store) => store.updateLastSynced);
const setProcessingStatus = useStore((store) => store.setProcessingStatus);
@@ -39,14 +40,16 @@ export default function AppEffects({ setShow }) {
refreshMenuPins();
initNotes();
(async function () {
await initUser();
await updateLastSynced();
await resetReminders();
setIsVaultCreated(await db.vault.exists());
await showUpgradeReminderDialogs();
await initUser();
showUpgradeReminderDialogs();
await sync();
})();
},
[
sync,
updateLastSynced,
refreshColors,
refreshMenuPins,

View File

@@ -57,16 +57,15 @@ function StatusBar() {
{user.isEmailConfirmed ? "" : " (not verified)"}
</Text>
</Button>
{SyncStatus && (
<Button
variant="statusitem"
display="flex"
onClick={sync}
sx={{ alignItems: "center", justifyContent: "center" }}
>
<SyncStatus />
</Button>
)}
<Button
variant="statusitem"
display="flex"
onClick={sync}
sx={{ alignItems: "center", justifyContent: "center" }}
>
<SyncStatus />
</Button>
</>
) : (
<Button
@@ -150,7 +149,7 @@ function SyncStatus() {
const syncStatus = useAppStore((state) => state.syncStatus);
const lastSynced = useAppStore((state) => state.lastSynced);
if (!lastSynced) return null;
if (!lastSynced && syncStatus === "synced") return null;
switch (syncStatus) {
case "synced":
return (

View File

@@ -87,7 +87,6 @@ class UserStore extends BaseStore {
await db.connectSSE();
}
});
await appStore.sync();
return true;
});
};

View File

@@ -95,7 +95,7 @@ const authTypes = {
},
loading: {
title: "Logging you in",
text: "Please wait while your data is downloaded & decrypted.",
text: "Please wait while you are authenticated.",
},
supportsPasswordRecovery: true,
onSubmit: async (form, onError) => {