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; }