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
chore: update router loader (#1102)
boojackd29c40dc7106
diff --git a/web/src/components/Settings/SystemSection.tsx b/web/src/components/Settings/SystemSection.tsxindex be4a64ab4..515615972 100644--- a/web/src/components/Settings/SystemSection.tsx+++ b/web/src/components/Settings/SystemSection.tsx@@ -157,10 +157,6 @@ const SystemSection = () => {<span className="normal-text">{t("setting.system-section.disable-public-memos")}</span><Switch checked={state.disablePublicMemos} onChange={(event) => handleDisablePublicMemosChanged(event.target.checked)} /></div>- <div className="form-label">- <span className="normal-text">Storage</span>- <Switch checked={state.disablePublicMemos} onChange={(event) => handleDisablePublicMemosChanged(event.target.checked)} />- </div><Divider className="!mt-3 !my-4" /><div className="form-label"><span className="normal-text">{t("setting.system-section.additional-style")}</span>diff --git a/web/src/i18n.ts b/web/src/i18n.tsindex 41873cf23..5430836a5 100644--- a/web/src/i18n.ts+++ b/web/src/i18n.ts@@ -52,7 +52,7 @@ i18n.use(initReactI18next).init({translation: hantLocale,},},- lng: "nl",+ lng: "en",fallbackLng: "en",});diff --git a/web/src/router/index.tsx b/web/src/router/index.tsxindex b9748c836..36a4e795a 100644--- a/web/src/router/index.tsx+++ b/web/src/router/index.tsx@@ -11,16 +11,28 @@ const MemoDetail = lazy(() => import("../pages/MemoDetail"));const EmbedMemo = lazy(() => import("../pages/EmbedMemo"));const NotFound = lazy(() => import("../pages/NotFound"));+const initialGlobalStateLoader = (() => {+ let done = false;++ return async () => {+ if (done) {+ return;+ }+ done = true;+ try {+ await initialGlobalState();+ } catch (error) {+ // do nth+ }+ };+})();+const router = createBrowserRouter([{path: "/auth",element: <Auth />,loader: async () => {- try {- await initialGlobalState();- } catch (error) {- // do nth- }+ await initialGlobalStateLoader();return null;},},@@ -28,8 +40,9 @@ const router = createBrowserRouter([path: "/",element: <Home />,loader: async () => {+ await initialGlobalStateLoader();+try {- await initialGlobalState();await initialUserState();} catch (error) {// do nth@@ -48,8 +61,9 @@ const router = createBrowserRouter([path: "/u/:userId",element: <Home />,loader: async () => {+ await initialGlobalStateLoader();+try {- await initialGlobalState();await initialUserState();} catch (error) {// do nth@@ -66,8 +80,9 @@ const router = createBrowserRouter([path: "/explore",element: <Explore />,loader: async () => {+ await initialGlobalStateLoader();+try {- await initialGlobalState();await initialUserState();} catch (error) {// do nth@@ -84,8 +99,9 @@ const router = createBrowserRouter([path: "/m/:memoId",element: <MemoDetail />,loader: async () => {+ await initialGlobalStateLoader();+try {- await initialGlobalState();await initialUserState();} catch (error) {// do nth@@ -102,8 +118,9 @@ const router = createBrowserRouter([path: "/m/:memoId/embed",element: <EmbedMemo />,loader: async () => {+ await initialGlobalStateLoader();+try {- await initialGlobalState();await initialUserState();} catch (error) {// do nth@@ -115,11 +132,7 @@ const router = createBrowserRouter([path: "*",element: <NotFound />,loader: async () => {- try {- await initialGlobalState();- } catch (error) {- // do nth- }+ await initialGlobalStateLoader();return null;},},