Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
fix(web): render the Home composer with the page
boojack02e163f8d7ea
diff --git a/web/src/components/MemoEditor/MemoEditor.tsx b/web/src/components/MemoEditor/MemoEditor.tsxindex 032deef07..e67c72fc7 100644--- a/web/src/components/MemoEditor/MemoEditor.tsx+++ b/web/src/components/MemoEditor/MemoEditor.tsx@@ -162,8 +162,14 @@ const MemoEditorDraft = ({ draft, ...editing }: MemoEditorDraftProps) => {const identity: MemoEditIdentity = draft.parent? { kind: "comment", parent: draft.parent }: { kind: "new", scope: draft.scope ?? "default", space: draft.space };+ // While the session's code loads, a still of the empty composer: the same frame, the+ // placeholder line and the toolbar's height, so the page below does not move when the+ // session takes its place.const fallback = editing.frameless ? null : (- <div aria-hidden className={cn("w-full min-h-28 rounded-lg border border-border/70 bg-card", editing.className)} />+ <div aria-hidden className={cn("flex w-full flex-col gap-2 rounded-lg border border-border/70 bg-card px-4 py-3", editing.className)}>+ <div className="w-full text-base leading-6 text-muted-foreground">{editing.placeholder ?? " "}</div>+ <div className="h-9 w-full" />+ </div>);return (<Suspense fallback={fallback}>diff --git a/web/src/components/MemoEditor/README.md b/web/src/components/MemoEditor/README.mdindex eaa8c5b76..2c8ca39b9 100644--- a/web/src/components/MemoEditor/README.md+++ b/web/src/components/MemoEditor/README.md@@ -61,7 +61,7 @@ Hosts of a new top-level memo pass `useMemoSuggestions()` into `suggestions`; ed- **Inline** (Home, panels): the session brings its own frame. The + menu offers focus mode, which expands it over the page; the exit button minimizes it back.- **Hosted** (`onFocusModeExit`): a host presents the session full-screen and owns that frame (`contexts/GlobalMemoEditorContext.tsx`). It mounts straight into focus mode and exits by calling back to dismiss the host.-The session's code is a chunk of its own, loaded when a memo is first edited or composed, and renders without suspending once loaded; a host that knows an editor is coming calls `preloadMemoEditing()`.+The session's code is a chunk of its own, loaded when a memo is first edited or composed, and renders without suspending once loaded. A host that knows an editor is coming calls `preloadMemoEditing()`: the router loads it with the Home page for a signed-in user, so the composer renders with the page, and the comment section loads it while the pointer is on its button. Until it is loaded a new draft shows a still of the empty composer, the same frame, placeholder line and toolbar height, so nothing moves when the session takes its place.### Destination and visibilitydiff --git a/web/src/router/index.tsx b/web/src/router/index.tsxindex ff2433ea9..e3466e345 100644--- a/web/src/router/index.tsx+++ b/web/src/router/index.tsx@@ -1,6 +1,7 @@import { createBrowserRouter, Navigate, type RouteObject, useLocation } from "react-router-dom";import App from "@/App";import { ChunkLoadErrorFallback } from "@/components/ErrorBoundary";+import { preloadMemoEditing } from "@/components/MemoEditor";import { useAuth } from "@/contexts/AuthContext";import useCurrentUser from "@/hooks/useCurrentUser";import MainLayout from "@/layouts/MainLayout";@@ -18,6 +19,9 @@ const AuthCallback = lazyWithReload(() => import("@/pages/AuthCallback"));const MemoMap = lazyWithReload(() => import("@/pages/Map"));const Calendar = lazyWithReload(() => import("@/pages/Calendar"));const Home = lazyWithReload(() => import("@/pages/Home"));+// A signed-in user's Home composes at once, so the page's code arrives together with the+// editing session's and the composer renders with the page, never after it.+const ComposingHome = lazyWithReload(() => Promise.all([import("@/pages/Home"), preloadMemoEditing()]).then(([page]) => page));const Inboxes = lazyWithReload(() => import("@/pages/Inboxes"));const MemoDetail = lazyWithReload(() => import("@/pages/MemoDetail"));const NotFound = lazyWithReload(() => import("@/pages/NotFound"));@@ -36,14 +40,15 @@ const HomeRoute = () => {if (!currentUser && !getCollectionCreator(location.search)) {return <Navigate to={{ pathname: ROUTES.EXPLORE, search: location.search, hash: location.hash }} replace />;}- return <Home />;+ return currentUser ? <ComposingHome /> : <Home />;};const ExploreRoute = () => {+ const currentUser = useCurrentUser();const location = useLocation();const search = withCollectionCreator(location.search);if (search !== location.search) return <Navigate to={{ pathname: location.pathname, search, hash: location.hash }} replace />;- return <Home />;+ return currentUser ? <ComposingHome /> : <Home />;};// Backward compatibility alias.