AOSSIE-Org / AOSSIE-Org/Resonate

Prevent multiple room creation requests on rapid button taps

Aperta
#756 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Dart
Stelle
344
Fork
350
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### 🐛 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.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.