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:
parent
261c2695ae
commit
6421377c86
|
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue