React 18 and Vite (#4510)

This commit is contained in:
Matthew Penner 2022-11-25 13:25:03 -07:00 committed by GitHub
parent 1bb1b13f6d
commit 21613fa602
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
244 changed files with 4547 additions and 8933 deletions

View file

@ -1,4 +1,3 @@
import React from 'react';
import { ServerContext } from '@/state/server';
import TitledGreyBox from '@/components/elements/TitledGreyBox';
import { Field as FormikField, Form, Formik, FormikHelpers, useFormikContext } from 'formik';
@ -43,15 +42,15 @@ const RenameServerBox = () => {
};
export default () => {
const server = ServerContext.useStoreState((state) => state.server.data!);
const setServer = ServerContext.useStoreActions((actions) => actions.server.setServer);
const server = ServerContext.useStoreState(state => state.server.data!);
const setServer = ServerContext.useStoreActions(actions => actions.server.setServer);
const { addError, clearFlashes } = useStoreActions((actions: Actions<ApplicationStore>) => actions.flashes);
const submit = ({ name, description }: Values, { setSubmitting }: FormikHelpers<Values>) => {
clearFlashes('settings');
renameServer(server.uuid, name, description)
.then(() => setServer({ ...server, name, description }))
.catch((error) => {
.catch(error => {
console.error(error);
addError({ key: 'settings', message: httpErrorToHuman(error) });
})
@ -63,7 +62,7 @@ export default () => {
onSubmit={submit}
initialValues={{
name: server.name,
description: server.description,
description: server.description ?? '',
}}
validationSchema={object().shape({
name: string().required().min(1),