Merge pull request #861 from pangeachat/stack-overflow-fix
don't call messagesSinceUpdate from clearMessagesSinceUpdate repeatedly
This commit is contained in:
commit
80fc7a896b
2 changed files with 8 additions and 2 deletions
|
|
@ -162,7 +162,8 @@ class GetAnalyticsController {
|
|||
return formattedCache;
|
||||
} catch (err) {
|
||||
// if something goes wrong while trying to format the local data, clear it
|
||||
_pangeaController.myAnalytics.clearMessagesSinceUpdate();
|
||||
_pangeaController.myAnalytics
|
||||
.clearMessagesSinceUpdate(clearDrafts: true);
|
||||
return {};
|
||||
}
|
||||
} catch (exception, stackTrace) {
|
||||
|
|
|
|||
|
|
@ -243,7 +243,12 @@ class MyAnalyticsController extends BaseController<AnalyticsStream> {
|
|||
}
|
||||
|
||||
/// Clears the local cache of recently sent constructs. Called before updating analytics
|
||||
void clearMessagesSinceUpdate() {
|
||||
void clearMessagesSinceUpdate({clearDrafts = false}) {
|
||||
if (clearDrafts) {
|
||||
_pangeaController.pStoreService.delete(PLocalKey.messagesSinceUpdate);
|
||||
return;
|
||||
}
|
||||
|
||||
final localCache = _pangeaController.analytics.messagesSinceUpdate;
|
||||
final draftKeys = localCache.keys.where((key) => key.startsWith('draft'));
|
||||
if (draftKeys.isEmpty) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue