fix: lyrics not refetching when tracked changed while being in another page and sidebar user avatar not showing on startup

This commit is contained in:
Kingkor Roy Tirtho 2022-12-14 14:08:23 +06:00
parent d674b61275
commit bd126751e9
8 changed files with 18 additions and 32 deletions

View File

@ -29,7 +29,7 @@ All types of contributions are encouraged and valued. See the [Table of Contents
## Code of Conduct
This project and everyone participating in it is governed by the
[Spotube Code of Conduct](https://github.com/KRTirtho/spotubeblob/master/CODE_OF_CONDUCT.md).
[Spotube Code of Conduct](https://github.com/KRTirtho/spotube/blob/master/CODE_OF_CONDUCT.md).
By participating, you are expected to uphold this code. Please report unacceptable behavior
to <>.

View File

@ -198,14 +198,6 @@ class SidebarFooter extends HookConsumerWidget {
placeholder: ImagePlaceholder.artist,
);
useEffect(() {
if (auth.isLoggedIn && !me.hasData) {
me.setExternalData(ref.read(spotifyProvider));
me.refetch();
}
return;
}, [auth.isLoggedIn, me.hasData]);
return Padding(
padding: const EdgeInsets.all(16).copyWith(left: 0),
child: Row(

View File

@ -27,7 +27,7 @@ import 'package:spotube/themes/dark_theme.dart';
import 'package:spotube/themes/light_theme.dart';
import 'package:spotube/utils/platform.dart';
final bowl = QueryBowl(refetchOnExternalDataChange: true);
final bowl = QueryBowl();
void main() async {
await Hive.initFlutter();
Hive.registerAdapter(CacheTrackAdapter());

View File

@ -33,17 +33,6 @@ class GeniusLyrics extends HookConsumerWidget {
final breakpoint = useBreakpoints();
final textTheme = Theme.of(context).textTheme;
useEffect(() {
if (playback.track != null) {
geniusLyricsQuery.setExternalData(Tuple2(
playback.track,
ref.read(userPreferencesProvider).geniusAccessToken,
));
geniusLyricsQuery.refetch();
}
return null;
}, [playback.track]);
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
@ -75,7 +64,8 @@ class GeniusLyrics extends HookConsumerWidget {
padding: const EdgeInsets.all(8.0),
child: Builder(
builder: (context) {
if (geniusLyricsQuery.isLoading) {
if (geniusLyricsQuery.isLoading ||
geniusLyricsQuery.isRefetching) {
return const ShimmerLyrics();
} else if (geniusLyricsQuery.hasError) {
return Text(

View File

@ -9,6 +9,7 @@ import 'package:tuple/tuple.dart';
class LyricsQueries {
final static = QueryJob<String, Tuple2<Track?, String>>(
queryKey: "genius-lyrics-query",
refetchOnExternalDataChange: true,
task: (_, externalData) async {
final currentTrack = externalData.item1;
final geniusAccessToken = externalData.item2;

View File

@ -6,6 +6,7 @@ class SearchQueries {
final get = InfiniteQueryJob.withVariableKey<List<Page>,
Tuple2<String, SpotifyApi>, int>(
preQueryKey: "search-query",
refetchOnExternalDataChange: true,
initialParam: 0,
enabled: false,
getNextPageParam: (lastPage, lastParam) =>

View File

@ -359,7 +359,7 @@ packages:
name: connectivity_plus
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.7"
version: "2.3.9"
connectivity_plus_linux:
dependency: transitive
description:
@ -387,7 +387,7 @@ packages:
name: connectivity_plus_web
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.4"
version: "1.2.5"
connectivity_plus_windows:
dependency: transitive
description:
@ -489,16 +489,16 @@ packages:
fl_query:
dependency: "direct main"
description:
name: fl_query
url: "https://pub.dartlang.org"
source: hosted
path: "../fl-query/packages/fl_query"
relative: true
source: path
version: "0.3.1"
fl_query_hooks:
dependency: "direct main"
description:
name: fl_query_hooks
url: "https://pub.dartlang.org"
source: hosted
path: "../fl-query/packages/fl_query_hooks"
relative: true
source: path
version: "0.3.1"
fluent_ui:
dependency: "direct main"

View File

@ -57,8 +57,10 @@ dependencies:
url: https://github.com/KRTirtho/metadata_god.git
ref: 7d195fdde324b382fc12067c56391285807e6233
visibility_detector: ^0.3.3
fl_query: ^0.3.1
fl_query_hooks: ^0.3.1
fl_query:
path: ../fl-query/packages/fl_query
fl_query_hooks:
path: ../fl-query/packages/fl_query_hooks
flutter_inappwebview: ^5.4.3+7
tuple: ^2.0.1
uuid: ^3.0.6