AOSSIE-Org / AOSSIE-Org/Resonate
Sign-Up button allows multiple taps causing duplicate API calls & "User already exists" error
- Langage dominant
- Dart
- Étoiles
- 344
- Forks
- 350
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
### 🐛 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;
}
}
}
Guide de contribution
Ouvrir le guide de contribution
Évaluation
Cette issue n'a pas encore été évaluée.