Skip to content

Commit

Permalink
fix: spotify query hooks overriding default query params
Browse files Browse the repository at this point in the history
  • Loading branch information
KRTirtho committed Mar 12, 2023
1 parent 23473af commit ec9a02e
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 18 deletions.
4 changes: 2 additions & 2 deletions lib/hooks/use_spotify_infinite_query.dart
Expand Up @@ -15,8 +15,8 @@ InfiniteQuery<DataType, ErrorType, PageType>
required WidgetRef ref,
required InfiniteQueryNextPage<DataType, PageType> nextPage,
required PageType initialPage,
RetryConfig retryConfig = DefaultConstants.retryConfig,
RefreshConfig refreshConfig = DefaultConstants.refreshConfig,
RetryConfig? retryConfig,
RefreshConfig? refreshConfig,
JsonConfig<DataType>? jsonConfig,
ValueChanged<PageEvent<DataType, PageType>>? onData,
ValueChanged<PageEvent<ErrorType, PageType>>? onError,
Expand Down
2 changes: 1 addition & 1 deletion lib/hooks/use_spotify_mutation.dart
Expand Up @@ -10,7 +10,7 @@ Mutation<DataType, ErrorType, VariablesType>
Future<DataType> Function(VariablesType variables, SpotifyApi spotify)
mutationFn, {
required WidgetRef ref,
RetryConfig retryConfig = DefaultConstants.retryConfig,
RetryConfig? retryConfig,
MutationOnDataFn<DataType, RecoveryType>? onData,
MutationOnErrorFn<ErrorType, RecoveryType>? onError,
MutationOnMutationFn<VariablesType, RecoveryType>? onMutate,
Expand Down
4 changes: 2 additions & 2 deletions lib/hooks/use_spotify_query.dart
Expand Up @@ -16,8 +16,8 @@ Query<DataType, ErrorType> useSpotifyQuery<DataType, ErrorType>(
final SpotifyQueryFn<DataType> queryFn, {
required WidgetRef ref,
final DataType? initial,
final RetryConfig retryConfig = DefaultConstants.retryConfig,
final RefreshConfig refreshConfig = DefaultConstants.refreshConfig,
final RetryConfig? retryConfig,
final RefreshConfig? refreshConfig,
final JsonConfig<DataType>? jsonConfig,
final ValueChanged<DataType>? onData,
final ValueChanged<ErrorType>? onError,
Expand Down
1 change: 1 addition & 0 deletions lib/main.dart
Expand Up @@ -172,6 +172,7 @@ void main(List<String> rawArgs) async {
)
],
child: QueryClientProvider(
staleDuration: const Duration(minutes: 30),
child: const Spotube(),
),
);
Expand Down
7 changes: 0 additions & 7 deletions lib/services/queries/category.dart
@@ -1,5 +1,4 @@
import 'package:fl_query/fl_query.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:spotify/spotify.dart';
import 'package:spotube/hooks/use_spotify_infinite_query.dart';
Expand All @@ -9,8 +8,6 @@ class CategoryQueries {

InfiniteQuery<Page<Category>, dynamic, int> list(
WidgetRef ref, String recommendationMarket) {
final context = useContext();

return useSpotifyInfiniteQuery<Page<Category>, dynamic, int>(
"category-playlists",
(pageParam, spotify) async {
Expand All @@ -27,10 +24,6 @@ class CategoryQueries {
}
return lastPageData.nextOffset;
},
refreshConfig: RefreshConfig.withDefaults(
context,
staleDuration: const Duration(minutes: 30),
),
ref: ref,
);
}
Expand Down
8 changes: 4 additions & 4 deletions pubspec.lock
Expand Up @@ -534,18 +534,18 @@ packages:
dependency: "direct main"
description:
name: fl_query
sha256: d9ebed8f024ef8e1eb9770d632ed738539dc576374a3498d5344d6ab27708563
sha256: b119e0d7e4cb615780f6cab00e7b40f88f8f549d9f8d20f6e1076e08cbf97c42
url: "https://pub.dev"
source: hosted
version: "1.0.0-alpha.1"
version: "1.0.0-alpha.2"
fl_query_hooks:
dependency: "direct main"
description:
name: fl_query_hooks
sha256: "868974a332ff28ffd837edf995b8c579dac0e590215d8f4d13ce84c7b6f2e53c"
sha256: "9a4263cc5e1ef6e246089602256011172a9d3be212c41c08d67bc365ce6fec22"
url: "https://pub.dev"
source: hosted
version: "1.0.0-alpha.1"
version: "1.0.0-alpha.2"
fluent_ui:
dependency: "direct main"
description:
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Expand Up @@ -27,8 +27,8 @@ dependencies:
cupertino_icons: ^1.0.5
dbus: ^0.7.8
file_picker: ^5.2.2
fl_query: ^1.0.0-alpha.0
fl_query_hooks: ^1.0.0-alpha.0
fl_query: ^1.0.0-alpha.2
fl_query_hooks: ^1.0.0-alpha.2
fluent_ui: ^4.3.0
fluentui_system_icons: ^1.1.189
flutter:
Expand Down

0 comments on commit ec9a02e

Please sign in to comment.