refactor: clean code
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { createContext, useContext, useEffect, useMemo, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { CheckCard } from "@ant-design/pro-components";
|
||||
import { useDeepCompareEffect } from "ahooks";
|
||||
import { Button, Form, Input, Skeleton, message, notification } from "antd";
|
||||
import { createSchemaFieldRule } from "antd-zod";
|
||||
import { produce } from "immer";
|
||||
@@ -43,9 +42,9 @@ const SSLProviderEditFormLetsEncryptConfig = () => {
|
||||
});
|
||||
|
||||
const [formChanged, setFormChanged] = useState(false);
|
||||
useDeepCompareEffect(() => {
|
||||
useEffect(() => {
|
||||
setFormChanged(settings?.content?.provider !== SSLPROVIDERS.LETS_ENCRYPT);
|
||||
}, [settings]);
|
||||
}, [settings?.content?.provider]);
|
||||
|
||||
const handleFormChange = () => {
|
||||
setFormChanged(true);
|
||||
@@ -95,9 +94,9 @@ const SSLProviderEditFormZeroSSLConfig = () => {
|
||||
});
|
||||
|
||||
const [formChanged, setFormChanged] = useState(false);
|
||||
useDeepCompareEffect(() => {
|
||||
useEffect(() => {
|
||||
setFormChanged(settings?.content?.provider !== SSLPROVIDERS.ZERO_SSL);
|
||||
}, [settings]);
|
||||
}, [settings?.content?.provider]);
|
||||
|
||||
const handleFormChange = () => {
|
||||
setFormChanged(true);
|
||||
@@ -165,9 +164,9 @@ const SSLProviderEditFormGoogleTrustServicesConfig = () => {
|
||||
});
|
||||
|
||||
const [formChanged, setFormChanged] = useState(false);
|
||||
useDeepCompareEffect(() => {
|
||||
useEffect(() => {
|
||||
setFormChanged(settings?.content?.provider !== SSLPROVIDERS.GOOGLE_TRUST_SERVICES);
|
||||
}, [settings]);
|
||||
}, [settings?.content?.provider]);
|
||||
|
||||
const handleFormChange = () => {
|
||||
setFormChanged(true);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user