Skip to content

Commit

Permalink
fix(portal): fix form undefined from validation (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
KsiBart authored and james-tran-3005 committed Nov 20, 2024
1 parent 44e9660 commit 876906f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ import { Text } from "@/components/Text";
import { useGetValidateServerName } from '@/hooks/product';
import { useAppStore } from '@/stores/app.store';
import { validateServerName, validateURL } from '@/utils/helpers/validators';
import { Form, FormInstance, Input } from "antd";
import { Form, Input } from "antd";
import { useMemo } from 'react';

type Props = {
form?: FormInstance<any>;
name?: string;
};

const SelectAPIServer = ({ form }: Props) => {
const SelectAPIServer = ({ name }: Props) => {
const { currentProduct } = useAppStore();
const { mutateAsync: validateName } = useGetValidateServerName();
const originalName = form?.getFieldsValue(["name"])?.name ?? null;
const originalName = useMemo(() => name ?? "", [name])

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ const NewAPIServer = () => {
>
<main id="12" className={styles.paper} style={{ flex: 1 }}>
<div id="12" style={{ maxWidth: "60%", minWidth: 600 }}>
<SelectAPIServer form={form}/>
<SelectAPIServer name={get(componentDetail, "metadata.name")}/>
<AddEnv form={form} env={env} />
<UploadYaml form={form} />
</div>
Expand Down

0 comments on commit 876906f

Please sign in to comment.