fix: state update on unmounted hook and infinite query cache refetch not working

This commit is contained in:
Kingkor Roy Tirtho
2023-02-10 18:52:27 +06:00
parent 02d11d2f46
commit 0af8190cf8
6 changed files with 55 additions and 19 deletions
+4 -4
View File
@@ -195,13 +195,13 @@ abstract class BaseQuery<T extends Object, Outside, Error>
notifyListeners();
return data;
}
final x = hasData && !isPreviousData;
var isOnline = await isNetworkOnline;
/// if isLoading/isRefetching is true that means its already fetching/
/// refetching. So [_execute] again can create a race condition
if (isLoading ||
isRefetching ||
!(await isNetworkOnline) ||
(hasData && !isPreviousData)) return data;
if (isLoading || isRefetching || !isOnline || (hasData && !isPreviousData))
return data;
status = QueryStatus.loading;
notifyListeners();
return execute().then((_) {