refactor: clean code

This commit is contained in:
Fu Diwei
2025-01-05 22:59:00 +08:00
parent 350160833b
commit 6f1a375fee
4 changed files with 13 additions and 17 deletions

View File

@@ -11,7 +11,6 @@ import {
UndoOutlined as UndoOutlinedIcon,
} from "@ant-design/icons";
import { PageHeader } from "@ant-design/pro-components";
import { useDeepCompareEffect } from "ahooks";
import { Alert, Button, Card, Dropdown, Form, Input, Modal, Space, Tabs, Typography, message, notification } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { ClientResponseError } from "pocketbase";
@@ -58,7 +57,7 @@ const WorkflowDetail = () => {
const [allowDiscard, setAllowDiscard] = useState(false);
const [allowRelease, setAllowRelease] = useState(false);
const [allowRun, setAllowRun] = useState(false);
useDeepCompareEffect(() => {
useEffect(() => {
const hasReleased = !!workflow.content;
const hasChanges = workflow.hasDraft! || !isEqual(workflow.draft, workflow.content);
setAllowDiscard(!isRunning && hasReleased && hasChanges);