The Real Fullstack

The Duplicate Form Submission

We disabled the submit button. Why do duplicate tickets keep appearing?

مستكشف6 دقيقةمحاكي التدفّقتحدي الشيفرة
angularrxjshttpvue

لم يُترجم هذا التحدي إلى العربية بعد. أنت تقرأ النسخة الإنجليزية.

المهمة:Guarantee one ticket per form submission under double clicks, timeouts and slow databases — while still retrying so customers aren't left guessing.السياق · أهداف التعلّم ▾

Larkspur's support form creates a ticket and sends a confirmation e-mail. Some customers double-click; others are on flaky mobile networks where the HTTP client retries after a timeout. Duplicates confuse agents and annoy customers.

المهمة: Guarantee one ticket per form submission under double clicks, timeouts and slow databases — while still retrying so customers aren't left guessing.

أهداف التعلّم

  • Distinguish UI-level guards from server-side idempotency.
  • Use exhaustMap / disabled states for user experience.
  • Send an idempotency key that survives retries.
المحاكاةمحاكاة
Support formAPITicket serviceTickets DBConfirmation e-mail
تشغيل المحاكاة
submit() {  this.http.post('/support-tickets', this.form.value).subscribe(() => this.done());}

تبسيط

Three failure switches. The server side reuses the idempotency model from The Duplicate Payment. نموذج تعليمي — الأرقام توضّح سلوكًا وليست قياسات أداء.

المفاهيم

تحديات ذات صلة

المراجع