AOSSIE-Org / AOSSIE-Org/Resonate

Sign-Up button allows multiple taps causing duplicate API calls & "User already exists" error

Abierto
#612 18 comentarios 0 reacciones 1 asignado Reclamado por @dolliecoder Ver en GitHub
enhancement
Lenguaje dominante
Dart
Estrellas
344
Forks
350
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

### 🐛 Describe the bug

### 🐞 Bug Report: Multiple Sign-Up API Calls Due to Rapid Button Taps

#### **Description**
During sign-up, if the user taps the **Sign Up** button multiple times quickly, the app sends multiple API requests to Appwrite.
The first request successfully creates the user, but the subsequent requests fail with:

> "User already exists"

This causes poor UX and unnecessary backend load.

---
### 🎥 Attached Video
[signup_limiter_error.mp4](https://streamable.com/8kdvlt)

---

### **Steps to Reproduce**
1. Open the Sign-Up screen.
2. Enter valid name/email/password.
3. Tap the **Sign Up** button rapidly multiple times.
4. Observe that multiple API calls are triggered.
5. The app eventually shows "User already exists" even though sign-up succeeded on the first tap.

---

### **Expected Behavior**
- After the first tap:
- The **Sign Up** button should be disabled.
- A loading indicator should be shown.
- Further taps must be ignored.
- Only **one** sign-up API call should be allowed at a time.

---

### **Actual Behavior**
- Button remains clickable during the sign-up API call.
- Multiple requests are sent.
- First request creates the user.
- Following requests fail → *“User already exists”*.
- No loading feedback or tap lock is shown to the user.

---

### ✔ Proposed Production-Quality Fix

A simple button-disable helps, but a more reliable and scalable fix is recommended to prevent
multiple API calls and "User already exists" errors.

#### ✅ 1. Add an atomic processing lock at controller/viewmodel level
This prevents multiple parallel API calls even if the UI rebuilds.

```dart
class SignupController {
bool _isProcessing = false;

Future signupUser() async {
if (_isProcessing) return; // HARD LOCK

_isProcessing = true;
try {
await AppwriteAuth.signup(); // API call
} finally {
_isProcessing = false;
}
}
}

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.