Skip to content

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

fix: do not close editor when dialog opens

thecodrr2cf73c4ecc06
diff --git a/apps/web/src/navigation/hash-routes.js b/apps/web/src/navigation/hash-routes.js
index 8e6ba1da1..2c35c63ae 100644
--- a/apps/web/src/navigation/hash-routes.js
+++ b/apps/web/src/navigation/hash-routes.js
@@ -21,12 +21,15 @@ import {
import { hashNavigate } from ".";
import { Suspense } from "react";
import EditorLoading from "../components/editor/loading";
+import EditorPlaceholder from "../components/editor/-placeholder";
const Editor = React.lazy(() => import("../components/editor"));
const hashroutes = {
"/": () => {
closeOpenedDialog();
if (isMobile() || isTablet()) editorStore.clearSession(false);
+
+ return !editorStore.get().session.state && <EditorPlaceholder />;
},
"/email/verify": () => {
showEmailVerificationDialog();
@@ -60,6 +63,7 @@ const hashroutes = {
);
},
"/notes/:noteId/unlock": ({ noteId }) => {
+ console.log("Unlocking", noteId);
return (
<RouteContainer
buttons={{
diff --git a/apps/web/src/utils/use-hash-routes.js b/apps/web/src/utils/use-hash-routes.js
index 43814a844..b87180cd7 100644
--- a/apps/web/src/utils/use-hash-routes.js
+++ b/apps/web/src/utils/use-hash-routes.js
@@ -1,13 +1,17 @@
import makeMatcher from "wouter/matcher";
import useHashLocation from "./use-hash-location";
+var lastRoute = null;
export default function useHashRoutes(routes) {
const [location] = useHashLocation();
const matcher = makeMatcher();
for (var key in routes) {
const [match, params] = matcher(key, location);
if (match) {
- return routes[key](params);
+ const route = routes[key](params);
+ if (!route) return lastRoute;
+ lastRoute = route;
+ return route;
}
}
}