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: state mismatch in Storage and System pages (#4719)
eya464924b238847f
diff --git a/web/src/components/Settings/StorageSection.tsx b/web/src/components/Settings/StorageSection.tsxindex 055c42d56..ba28aac4f 100644--- a/web/src/components/Settings/StorageSection.tsx+++ b/web/src/components/Settings/StorageSection.tsx@@ -2,7 +2,7 @@ import { Divider, List, ListItem, Radio, RadioGroup, Tooltip, Switch } from "@muimport { Button, Input } from "@usememos/mui";import { isEqual } from "lodash-es";import { HelpCircleIcon } from "lucide-react";-import React, { useMemo, useState } from "react";+import React, { useEffect, useMemo, useState } from "react";import { toast } from "react-hot-toast";import { Link } from "react-router-dom";import { workspaceSettingNamePrefix } from "@/store/v1";@@ -21,6 +21,12 @@ const StorageSection = () => {WorkspaceStorageSetting.fromPartial(workspaceStore.getWorkspaceSettingByKey(WorkspaceSettingKey.STORAGE)?.storageSetting || {}),);+ useEffect(() => {+ setWorkspaceStorageSetting(+ WorkspaceStorageSetting.fromPartial(workspaceStore.getWorkspaceSettingByKey(WorkspaceSettingKey.STORAGE)?.storageSetting || {}),+ );+ }, [workspaceStore.getWorkspaceSettingByKey(WorkspaceSettingKey.STORAGE)]);+const allowSaveStorageSetting = useMemo(() => {if (workspaceStorageSetting.uploadSizeLimitMb <= 0) {return false;diff --git a/web/src/components/Settings/WorkspaceSection.tsx b/web/src/components/Settings/WorkspaceSection.tsxindex c214838ed..aa2cfba9b 100644--- a/web/src/components/Settings/WorkspaceSection.tsx+++ b/web/src/components/Settings/WorkspaceSection.tsx@@ -2,6 +2,7 @@ import { Select, Option, Divider, Switch } from "@mui/joy";import { Button, Textarea } from "@usememos/mui";import { isEqual } from "lodash-es";import { ExternalLinkIcon } from "lucide-react";+import { observer } from "mobx-react-lite";import { useEffect, useState } from "react";import { toast } from "react-hot-toast";import { Link } from "react-router-dom";@@ -14,7 +15,7 @@ import { WorkspaceGeneralSetting } from "@/types/proto/api/v1/workspace_setting_import { useTranslate } from "@/utils/i18n";import showUpdateCustomizedProfileDialog from "../UpdateCustomizedProfileDialog";-const WorkspaceSection = () => {+const WorkspaceSection = observer(() => {const t = useTranslate();const originalSetting = WorkspaceGeneralSetting.fromPartial(workspaceStore.getWorkspaceSettingByKey(WorkspaceSettingKey.GENERAL)?.generalSetting || {},@@ -23,7 +24,7 @@ const WorkspaceSection = () => {const [identityProviderList, setIdentityProviderList] = useState<IdentityProvider[]>([]);useEffect(() => {- setWorkspaceGeneralSetting(originalSetting);+ setWorkspaceGeneralSetting({ ...workspaceGeneralSetting, customProfile: originalSetting.customProfile });}, [workspaceStore.getWorkspaceSettingByKey(WorkspaceSettingKey.GENERAL)]);const handleUpdateCustomizedProfileButtonClick = () => {@@ -162,6 +163,6 @@ const WorkspaceSection = () => {</div></div>);-};+});export default WorkspaceSection;