Commit 7e48d138 authored by johnnyjoy's avatar johnnyjoy

fix: workspace setting state

parent 4fcc682a
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 () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment