Fix multi-click submit bug and add draft submit indicator on juror dashboard
All checks were successful
Build and Push Docker Image / build (push) Successful in 8m24s
All checks were successful
Build and Push Docker Image / build (push) Successful in 8m24s
- Initialize slider values to midpoint so visual matches stored value (root cause: sliders appeared filled but criteriaValues was undefined) - Use mutateAsync for submit to properly await and prevent double-clicks - Add startMutation.isPending to submit button disabled state - Add error toast in evaluation-form.tsx catch block (was silent) - Show "Ready to submit" badge and "Review & Submit" button for drafts on juror dashboard Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -303,7 +303,10 @@ export function EvaluationForm({
|
||||
|
||||
// Submit handler
|
||||
const onSubmit = async (data: EvaluationFormData) => {
|
||||
if (!currentEvaluationId) return
|
||||
if (!currentEvaluationId) {
|
||||
toast.error('Evaluation is still being created. Please wait a moment and try again.')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await submit.mutateAsync({
|
||||
@@ -325,6 +328,7 @@ export function EvaluationForm({
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('Submit failed:', error)
|
||||
toast.error(error instanceof Error ? error.message : 'Failed to submit evaluation. Please try again.')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -359,7 +363,7 @@ export function EvaluationForm({
|
||||
<AlertDialogTrigger asChild>
|
||||
<Button
|
||||
type="button"
|
||||
disabled={!isValid || submit.isPending}
|
||||
disabled={!isValid || submit.isPending || startEvaluation.isPending}
|
||||
>
|
||||
{submit.isPending ? (
|
||||
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
|
||||
@@ -678,7 +682,7 @@ export function EvaluationForm({
|
||||
<Button
|
||||
type="button"
|
||||
size="lg"
|
||||
disabled={!isValid || submit.isPending}
|
||||
disabled={!isValid || submit.isPending || startEvaluation.isPending}
|
||||
className="w-full sm:w-auto"
|
||||
>
|
||||
{submit.isPending ? (
|
||||
|
||||
Reference in New Issue
Block a user