refactor(QueryBowl): query bowl logic as a separate class instead of a stateful widget

feat: add QueryCache class for storing, updating, removing all the query/mutation/infiniteQueries
refactor(test): update tests according to new query bowl refactor
refactor(fl_query_hooks): update the hooks according to new query bowl refactor
This commit is contained in:
Kingkor Roy Tirtho
2022-09-22 22:03:28 +06:00
parent f435f101c4
commit 2b835505a3
22 changed files with 804 additions and 733 deletions
+16 -5
View File
@@ -254,22 +254,33 @@ abstract class BaseQuery<T extends Object, Outside, Error>
bool? refetchOnMount,
bool? refetchOnReconnect,
}) {
bool updated = false;
if (this.refetchInterval == null &&
refetchInterval != null &&
refetchInterval != Duration.zero) {
this.refetchInterval = refetchInterval;
_refetchIntervalTimer?.cancel();
_refetchIntervalTimer = createRefetchTimer();
updated = true;
}
if (this.cacheTime == Duration(minutes: 5) && cacheTime != null)
if (this.cacheTime == Duration(minutes: 5) && cacheTime != null) {
this.cacheTime = cacheTime;
updated = true;
}
if (this._staleTime == const Duration(milliseconds: 500) &&
staleTime != null) this._staleTime = staleTime;
if (this.refetchOnMount == null && refetchOnMount != null)
staleTime != null) {
this._staleTime = staleTime;
updated = true;
}
if (this.refetchOnMount == null && refetchOnMount != null) {
this.refetchOnMount = refetchOnMount;
if (this.refetchOnReconnect == null && refetchOnReconnect != null)
updated = true;
}
if (this.refetchOnReconnect == null && refetchOnReconnect != null) {
this.refetchOnReconnect = refetchOnReconnect;
notifyListeners();
updated = true;
}
if (updated) notifyListeners();
}
/// checks if the application is connected to internet in any mean