input hotfix

This commit is contained in:
rngsurrounded
2025-03-03 17:36:54 +09:00
parent 4ce12e787c
commit 889d49f955
2 changed files with 3 additions and 6 deletions
@@ -44,6 +44,9 @@ const CompetitionSession = () => {
queryClient.invalidateQueries({ queryClient.invalidateQueries({
queryKey: ['solutionHistory', competitionId, taskId] queryKey: ['solutionHistory', competitionId, taskId]
}); });
setAnswer("");
setSelectedFile(null);
}, },
onError: (error) => { onError: (error) => {
console.error("Error submitting solution:", error); console.error("Error submitting solution:", error);
@@ -40,12 +40,9 @@ const TaskSolution: React.FC<TaskSolutionProps> = ({
enabled: !!(competitionId && task.id), enabled: !!(competitionId && task.id),
}); });
// Get the solution history - already sorted from oldest to newest
const solutionHistory = solutionsQuery.data || []; const solutionHistory = solutionsQuery.data || [];
// Handle task changes // Handle task changes
useEffect(() => { useEffect(() => {
// If task changed, reset everything and load the latest solution
if (taskIdRef.current !== task.id) { if (taskIdRef.current !== task.id) {
setCurrentSolution(null); setCurrentSolution(null);
setSelectedSolutionUrl(null); setSelectedSolutionUrl(null);
@@ -115,9 +112,6 @@ const TaskSolution: React.FC<TaskSolutionProps> = ({
const handleSubmitWrapper = () => { const handleSubmitWrapper = () => {
onSubmit(); onSubmit();
setAnswer("");
setSelectedFile(null);
setSelectedSolutionUrl(null);
}; };
return ( return (