A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
web: show status when db is migrating on startup
Abdullah Attaa378bd397bed
diff --git a/apps/web/src/root.tsx b/apps/web/src/root.tsxindex ca82e8179..9abfd05d0 100644--- a/apps/web/src/root.tsx+++ b/apps/web/src/root.tsx@@ -33,6 +33,8 @@ import { AuthProps } from "./views/auth";import { loadDatabase } from "./hooks/use-database";import AppLock from "./views/app-lock";import { Text } from "@theme-ui/components";+import { EV, EVENTS } from "@notesnook/core";+import { useState } from "react";export async function startApp() {const rootElement = document.getElementById("root");@@ -54,14 +56,6 @@ export async function startApp() {await useKeyStore.getState().init();- performance.mark("load:database");- if (!useKeyStore.getState().isLocked)- loadDatabase(- path !== "/sessionexpired" || Config.get("sessionExpired", false)- ? "db"- : "memory"- );-root.render(<><TitleBar />@@ -102,8 +96,13 @@ function RouteWrapper(props: {path: Routes;routeProps: AuthProps | null;}) {+ const [isMigrating, setIsMigrating] = useState(false);const { Component, path, routeProps } = props;const result = usePromise(async () => {+ EV.subscribe(EVENTS.migrationStarted, () => setIsMigrating(true), true);+ EV.subscribe(EVENTS.migrationFinished, () => setIsMigrating(false), true);++ performance.mark("load:database");await loadDatabase(path !== "/sessionexpired" || Config.get("sessionExpired", false)? "db"@@ -116,7 +115,7 @@ function RouteWrapper(props: {? result.reason: new Error(result.reason);}- if (result.status === "pending")+ if (result.status === "pending" || isMigrating)return (<divstyle={{@@ -143,7 +142,9 @@ function RouteWrapper(props: {<use href="#themed-logo" /></svg><Text variant="body" sx={{ fontFamily: "monospace" }}>- Decrypting your notes+ {isMigrating+ ? "Migrating database. This might take a while."+ : "Decrypting your notes"}</Text></div>);