Fix double-submit bug in task creation form

- Add isSubmitting flag to prevent duplicate submissions
- Disable submit button and show "Creating..." text while processing
- Re-enable button after completion or error

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2025-12-03 21:36:44 -08:00
parent 261c2695ae
commit 6421377c86
1 changed files with 14 additions and 0 deletions

View File

@ -589,9 +589,19 @@
}
};
let isSubmitting = false;
document.getElementById('new-task-form').onsubmit = async (e) => {
e.preventDefault();
// Prevent double submission
if (isSubmitting) return;
isSubmitting = true;
const submitBtn = e.target.querySelector('button[type="submit"]');
const originalText = submitBtn.textContent;
submitBtn.textContent = 'Creating...';
submitBtn.disabled = true;
const projectPath = document.getElementById('task-project').value;
const title = document.getElementById('task-title').value;
const description = document.getElementById('task-description').value;
@ -626,6 +636,10 @@
} catch (err) {
console.error('Create error:', err);
showToast(err.message || 'Failed to create task', 'error');
} finally {
isSubmitting = false;
submitBtn.textContent = originalText;
submitBtn.disabled = false;
}
};