fix(fl_query_hooks): newest query/mutation/infinite-query instance not getting returned

This commit is contained in:
Kingkor Roy Tirtho
2022-09-23 09:50:22 +06:00
parent e0c3d7f4ba
commit 03a053bba6
6 changed files with 6 additions and 15 deletions
@@ -179,13 +179,6 @@ abstract class BaseQuery<T extends Object, Outside, Error>
/// the current available [data] instead of running the task to prevent
/// race conditions
Future<T?> refetch() async {
if (queryKey == "category-playlists#user-featured-playlists") {
print(
"Refetch Count of ${queryKey}-> ${refetchCount}",
);
print(StackTrace.current);
}
/// if isLoading/isRefetching is true that means its already fetching/
/// refetching. So [_execute] again can create a race condition
if (isRefetching || isLoading) return data;
@@ -211,7 +211,6 @@ class InfiniteQuery<T extends Object, Outside, PageParam extends Object>
}
@override
// TODO: implement debugLabel
String get debugLabel => "InfiniteQuery($queryKey)";
@override
+3 -4
View File
@@ -26,10 +26,9 @@ class QueryCache {
final Set<CacheUpdateListener<BaseOperation>> _listeners = {};
ReadonlySet<Query> get queries => UnmodifiableSetView(_queries);
ReadonlySet<InfiniteQuery> get infiniteQueries =>
UnmodifiableSetView(_infiniteQueries);
ReadonlySet<Mutation> get mutations => UnmodifiableSetView(_mutations);
Set<Query> get queries => _queries;
Set<InfiniteQuery> get infiniteQueries => _infiniteQueries;
Set<Mutation> get mutations => _mutations;
ReadonlySet<CacheUpdateListener<BaseOperation>> get listeners =>
UnmodifiableSetView(_listeners);
@@ -129,5 +129,5 @@ InfiniteQuery<T, Outside, PageParam>
return null;
});
return infiniteQuery.value;
return queryBowl.getInfiniteQuery(job.queryKey) ?? infiniteQuery.value;
}
@@ -85,5 +85,5 @@ Mutation<T, V> useMutation<T extends Object, V>({
return null;
});
return mutation.value;
return queryBowl.getMutation(job.mutationKey) ?? mutation.value;
}
@@ -125,5 +125,5 @@ Query<T, Outside> useQuery<T extends Object, Outside>({
return null;
});
return query.value;
return queryBowl.getQuery(job.queryKey) ?? query.value;
}