AOSSIE-Org / AOSSIE-Org/Resonate

Prevent multiple room creation requests on rapid button taps

Offen
#756 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Dart
Sterne
344
Forks
350
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.