AOSSIE-Org / AOSSIE-Org/Resonate
Prevent multiple room creation requests on rapid button taps
- Lenguaje dominante
- Dart
- Estrellas
- 344
- Forks
- 350
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
### 🐛 Describe the bug
The createRoom() method in CreateRoomController does not prevent multiple rapid invocations while a room creation request is already in progress.
Since the method performs an asynchronous backend call (RoomService.createRoom), repeated taps on the "Create Room" button before the first request completes can trigger multiple concurrent room creation requests.
This may result in:
Duplicate rooms being created
Multiple bottom sheets opening
Unnecessary backend writes
This issue is similar in pattern to the previously resolved duplicate async call issue (#612), where a loading guard was added to prevent repeated execution.
Sample code to reproduce the problem
## Sample code to reproduce the problem
```dart
Future createRoom(...) async {
try {
isLoading.value = true;
await RoomService.createRoom(
roomName: name,
roomDescription: description,
roomTags: tags,
adminUid: authStateController.uid!,
);
} finally {
isLoading.value = false;
}
}
```
There is no early return guard such as:
```dart
if (isLoading.value) return;
```
This allows multiple rapid invocations of the method before the first async call completes.
Observed behavior
When the method is triggered multiple times before the first async call completes, multiple backend requests may be sent to create rooms concurrently.
No exception is thrown, but duplicate side effects are possible due to lack of concurrency protection.
Guía de contribución
Evaluación
Este issue todavía no se ha evaluado.