Fix caching issues

pull/1186/head
Kelrap 1 year ago
parent fe54a71d33
commit 990980155e

@ -20,7 +20,7 @@ import '../../utils/error_handler.dart';
import '../../utils/overlay.dart'; import '../../utils/overlay.dart';
class _SpanDetailsCacheItem { class _SpanDetailsCacheItem {
SpanDetailsRepoReqAndRes data; Future<SpanDetailsRepoReqAndRes> data;
_SpanDetailsCacheItem({required this.data}); _SpanDetailsCacheItem({required this.data});
} }
@ -149,11 +149,11 @@ class IgcController {
/// Retrieves the [SpanDetailsRepoReqAndRes] response from the cache if it exists, /// Retrieves the [SpanDetailsRepoReqAndRes] response from the cache if it exists,
/// otherwise makes an API call to get the response and stores it in the cache. /// otherwise makes an API call to get the response and stores it in the cache.
SpanDetailsRepoReqAndRes response; Future<SpanDetailsRepoReqAndRes> response;
if (_cache.containsKey(cacheKey)) { if (_cache.containsKey(cacheKey)) {
response = _cache[cacheKey]!.data; response = _cache[cacheKey]!.data;
} else { } else {
response = await SpanDataRepo.getSpanDetails( response = SpanDataRepo.getSpanDetails(
await choreographer.accessToken, await choreographer.accessToken,
request: SpanDetailsRepoReqAndRes( request: SpanDetailsRepoReqAndRes(
userL1: choreographer.l1LangCode!, userL1: choreographer.l1LangCode!,
@ -167,7 +167,7 @@ class IgcController {
} }
try { try {
igcTextData!.matches[matchIndex].match = response.span; igcTextData!.matches[matchIndex].match = (await response).span;
} catch (err, s) { } catch (err, s) {
ErrorHandler.logError(e: err, s: s); ErrorHandler.logError(e: err, s: s);
} }

Loading…
Cancel
Save