Fixed the issue where addHistoryAsync did not update the cache.

This commit is contained in:
2025-02-14 22:35:57 +08:00
parent 23f9763fe8
commit c9b7ea97bf

View File

@@ -256,6 +256,16 @@ class HistoryManager with ChangeNotifier {
_haveAsyncTask = true; _haveAsyncTask = true;
await _addHistoryAsync(_db.handle.address, newItem); await _addHistoryAsync(_db.handle.address, newItem);
_haveAsyncTask = false; _haveAsyncTask = false;
if (_cachedHistoryIds == null) {
updateCache();
} else {
_cachedHistoryIds![newItem.id] = true;
}
cachedHistories[newItem.id] = newItem;
if (cachedHistories.length > 10) {
cachedHistories.remove(cachedHistories.keys.first);
}
notifyListeners();
} }
/// add history. if exists, update time. /// add history. if exists, update time.