Tag reload note count on download

This commit is contained in:
Mo Bitar
2020-03-22 10:30:23 -05:00
parent 07584150b9
commit 7dc3dab90b
6 changed files with 100 additions and 48 deletions

View File

@@ -472,7 +472,7 @@ class NotesCtrl extends PureCtrl {
});
}
if (note.errorDecrypting) {
if (note.waitingForKeys) {
if (note.waitingForKey) {
flags.push({
text: "Waiting For Keys",
class: 'info'

View File

@@ -146,7 +146,6 @@ class RootCtrl extends PureCtrl {
updateSyncStatus() {
const syncStatus = this.application.getSyncStatus();
const stats = syncStatus.getStats();
console.log("SN: RootCtrl -> updateSyncStatus -> stats", stats);
if (stats.downloadCount > 20) {
const text = `Downloading ${stats.downloadCount} items. Keep app open.`;
this.syncStatus = this.statusManager.replaceStatusWithString(

View File

@@ -1,4 +1,4 @@
import { SNNote, SNSmartTag, ContentTypes } from 'snjs';
import { SNNote, SNSmartTag, ContentTypes, ApplicationEvents } from 'snjs';
import template from '%/tags.pug';
import { AppStateEvents } from '@/state';
import { PANEL_NAME_TAGS } from '@/controllers/constants';
@@ -97,6 +97,21 @@ class TagsPanelCtrl extends PureCtrl {
}
}
/** @override */
async onAppEvent(eventName) {
super.onAppEvent(eventName);
if (eventName === ApplicationEvents.LocalDataIncrementalLoad) {
this.reloadNoteCounts();
} else if (eventName === ApplicationEvents.SyncStatusChanged) {
const syncStatus = this.application.getSyncStatus();
const stats = syncStatus.getStats();
if (stats.downloadCount > 0) {
this.reloadNoteCounts();
}
}
}
reloadNoteCounts() {
let allTags = [];
if (this.state.tags) {