v2.49.4 — Favoriten-Toggle race-sicher (kein PK-Crash bei Doppel-Tap)
## Fix (Code-Review Finding 2, HIGH) - DbHelper.songZurPlaylist: INSERT OR IGNORE (ConflictAlgorithm.ignore) — Doppel-Tap-Race verletzt PRIMARY KEY (playlist_id, song_id) nicht mehr - FavoritenService.umschalten: gibt neuen Status zurück, try/catch mit MeloLogger, Zustand nach Fehler aus DB neu geladen statt blind geflippt - NowPlayingScreen._toggleFavorit: In-Flight-Guard _toggleLaeuft gegen parallele Toggles + Statusübernahme aus DB (Quelle der Wahrheit)
This commit is contained in:
@@ -401,11 +401,13 @@ class DbHelper {
|
||||
|
||||
Future<void> songZurPlaylist(int playlistId, int songId, int position) async {
|
||||
final d = await db;
|
||||
// INSERT OR IGNORE: Song bereits in der Playlist (Race/Doppel-Tap) ist
|
||||
// kein Fehler — der Eintrag bleibt einfach bestehen (PK-Konflikt abgefangen).
|
||||
await d.insert('playlist_songs', {
|
||||
'playlist_id': playlistId,
|
||||
'song_id': songId,
|
||||
'position': position,
|
||||
});
|
||||
}, conflictAlgorithm: ConflictAlgorithm.ignore);
|
||||
}
|
||||
|
||||
Future<List<Map<String, dynamic>>> allePlaylists() async {
|
||||
|
||||
Reference in New Issue
Block a user