more optimizations

This commit is contained in:
yohlo
2025-08-27 11:04:04 -05:00
parent e5f3bbe095
commit b7de2e7af3
7 changed files with 49 additions and 23 deletions

View File

@@ -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