more optimizations
This commit is contained in:
@@ -11,6 +11,7 @@ import { logger } from "..";
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
import { tournamentQueries } from "@/features/tournaments/queries";
|
||||
import { DateTimePicker } from "@mantine/dates";
|
||||
import { useCallback } from "react";
|
||||
|
||||
interface TournamentFormProps {
|
||||
close: () => void;
|
||||
@@ -48,7 +49,7 @@ const TournamentForm = ({ close, initialValues, tournamentId }: TournamentFormPr
|
||||
|
||||
const isPending = createPending || updatePending;
|
||||
|
||||
const handleSubmit = async (values: TournamentFormInput) => {
|
||||
const handleSubmit = useCallback(async (values: TournamentFormInput) => {
|
||||
const { logo, ...tournamentData } = values;
|
||||
|
||||
const mutation = isEditMode ? updateTournament : createTournament;
|
||||
@@ -100,7 +101,7 @@ const TournamentForm = ({ close, initialValues, tournamentId }: TournamentFormPr
|
||||
logger.error(`Tournament ${isEditMode ? 'update' : 'create'} error`, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, [isEditMode, createTournament, updateTournament, queryClient]);
|
||||
|
||||
return (
|
||||
<SlidePanel
|
||||
|
||||
Reference in New Issue
Block a user