From 2751ab1296b5f23c58bc6cd487684c94f5c10d8f Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Tue, 27 Aug 2024 23:14:54 +0800 Subject: [PATCH] :bug: Bug fixes on loading state --- lib/main.dart | 3 ++- lib/services/server/sourced_track.dart | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index d7f245b..b2a49d1 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -59,11 +59,12 @@ class MyApp extends StatelessWidget { void _initializeProviders(BuildContext context) async { Get.lazyPut(() => SpotifyProvider()); + Get.put(DatabaseProvider()); + Get.put(AudioPlayerProvider()); Get.put(ActiveSourcedTrackProvider()); Get.put(AudioPlayerStreamProvider()); - Get.put(DatabaseProvider()); Get.put(PlaybackHistoryProvider()); Get.put(SegmentsProvider()); Get.put(PaletteProvider()); diff --git a/lib/services/server/sourced_track.dart b/lib/services/server/sourced_track.dart index 30b0ffd..3d48544 100755 --- a/lib/services/server/sourced_track.dart +++ b/lib/services/server/sourced_track.dart @@ -26,9 +26,13 @@ class SourcedTrackProvider extends GetxController { } }); - query.isQueryingTrackInfo.value = true; + final isCurrentTrack = playback.state.value.activeTrack?.id == track.id; + + if (isCurrentTrack) query.isQueryingTrackInfo.value = true; + sourcedTrack.value = await SourcedTrack.fetchFromTrack(track: track); - query.isQueryingTrackInfo.value = false; + + if (isCurrentTrack) query.isQueryingTrackInfo.value = false; return sourcedTrack.value; }