Skip to content

armgit / memos

Public Imported from GitHub
0

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.

fix: workspace setting state

johnnyjoy7e48d1383494
diff --git a/web/src/components/Settings/WorkspaceSection.tsx b/web/src/components/Settings/WorkspaceSection.tsx
index 39581190f..e997cdf3d 100644
--- a/web/src/components/Settings/WorkspaceSection.tsx
+++ b/web/src/components/Settings/WorkspaceSection.tsx
@@ -1,7 +1,7 @@
import { Button, Select, Textarea, Option, Divider, Switch } from "@mui/joy";
import { isEqual } from "lodash-es";
import { ExternalLinkIcon } from "lucide-react";
-import { useState } from "react";
+import { useEffect, useState } from "react";
import { toast } from "react-hot-toast";
import { Link } from "react-router-dom";
import { workspaceSettingNamePrefix, useWorkspaceSettingStore } from "@/store/v1";
@@ -18,16 +18,21 @@ const WorkspaceSection = () => {
);
const [workspaceGeneralSetting, setWorkspaceGeneralSetting] = useState<WorkspaceGeneralSetting>(originalSetting);
+ useEffect(() => {
+ setWorkspaceGeneralSetting(originalSetting);
+ }, [workspaceSettingStore.getWorkspaceSettingByKey(WorkspaceSettingKey.GENERAL)]);
+
const handleUpdateCustomizedProfileButtonClick = () => {
showUpdateCustomizedProfileDialog();
};
const updatePartialSetting = (partial: Partial<WorkspaceGeneralSetting>) => {
- const newWorkspaceGeneralSetting = WorkspaceGeneralSetting.fromPartial({
- ...workspaceGeneralSetting,
- ...partial,
- });
- setWorkspaceGeneralSetting(newWorkspaceGeneralSetting);
+ setWorkspaceGeneralSetting(
+ WorkspaceGeneralSetting.fromPartial({
+ ...workspaceGeneralSetting,
+ ...partial,
+ }),
+ );
};
const handleSaveGeneralSetting = async () => {