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. 教学模型——数字用于说明行为,并非基准测试。

概念

相关挑战

参考资料