diff --git a/resources/scripts/components/admin/servers/ServerStartupContainer.tsx b/resources/scripts/components/admin/servers/ServerStartupContainer.tsx index 72782a92d..0746acfe4 100644 --- a/resources/scripts/components/admin/servers/ServerStartupContainer.tsx +++ b/resources/scripts/components/admin/servers/ServerStartupContainer.tsx @@ -18,10 +18,14 @@ import { Actions, useStoreActions } from 'easy-peasy'; import Label from '@/components/elements/Label'; import { object } from 'yup'; -function ServerStartupLineContainer ({ egg, server }: { egg: Egg; server: Server }) { +function ServerStartupLineContainer ({ egg, server }: { egg: Egg | null; server: Server }) { const { isSubmitting, setFieldValue } = useFormikContext(); useEffect(() => { + if (egg === null) { + return; + } + if (server.eggId === egg.id) { setFieldValue('startup', server.container.startup); return; @@ -47,7 +51,7 @@ function ServerStartupLineContainer ({ egg, server }: { egg: Egg; server: Server
- +
); @@ -126,7 +130,7 @@ function ServerVariableContainer ({ variable, defaultValue }: { variable: EggVar ); } -function ServerStartupForm ({ egg, setEgg, server }: { egg: Egg, setEgg: (value: Egg | null) => void; server: Server }) { +function ServerStartupForm ({ egg, setEgg, server }: { egg: Egg | null, setEgg: (value: Egg | null) => void; server: Server }) { const { isSubmitting, isValid } = useFormikContext(); return ( @@ -154,7 +158,7 @@ function ServerStartupForm ({ egg, setEgg, server }: { egg: Egg, setEgg: (value:
- {egg.relations.variables?.map((v, i) => ( + {egg?.relations.variables?.map((v, i) => ( console.error(error)); }, []); - if (egg === null) { - return (<>); - } - const submit = (values: Values, { setSubmitting }: FormikHelpers) => { clearFlashes('server'); @@ -212,7 +212,7 @@ export default function ServerStartupContainer ({ server }: { server: Server }) initialValues={{ startup: server.container.startup, // Don't ask. - environment: Object.fromEntries(egg.relations.variables?.map(v => [ v.envVariable, '' ]) || []), + environment: Object.fromEntries(egg?.relations.variables?.map(v => [ v.envVariable, '' ]) || []), image: server.container.image, eggId: server.eggId, skipScripts: false,