fix: reload note counts (#797)

* fix: reload note counts

* fix: select smart tags on load
This commit is contained in:
Laurent Senta
2022-01-06 09:00:36 +01:00
committed by GitHub
parent e7a8bbbab8
commit 285fe31dd8
2 changed files with 16 additions and 3 deletions

View File

@@ -1,4 +1,3 @@
import { WebApplication } from '@/ui_models/application';
import { AppState } from '@/ui_models/app_state';
import { observer } from 'mobx-react-lite';
import { FunctionComponent } from 'preact';

View File

@@ -1,6 +1,7 @@
import { confirmDialog } from '@/services/alertService';
import { STRING_DELETE_TAG, STRING_MISSING_SYSTEM_TAG } from '@/strings';
import {
ApplicationEvent,
ComponentAction,
ContentType,
MessageData,
@@ -8,7 +9,7 @@ import {
SNSmartTag,
SNTag,
TagMutator,
UuidString
UuidString,
} from '@standardnotes/snjs';
import {
action,
@@ -16,7 +17,7 @@ import {
makeAutoObservable,
makeObservable,
observable,
runInAction
runInAction,
} from 'mobx';
import { WebApplication } from '../application';
import { FeaturesState, SMART_TAGS_FEATURE_NAME } from './features_state';
@@ -87,6 +88,7 @@ export class TagsState {
this.editing_ = undefined;
this.smartTags = this.application.getSmartTags();
this.selected_ = this.smartTags[0];
makeObservable(this, {
tags: observable.ref,
@@ -146,6 +148,18 @@ export class TagsState {
}
)
);
appEventListeners.push(
this.application.addEventObserver(async (eventName) => {
switch (eventName) {
case ApplicationEvent.CompletedIncrementalSync:
runInAction(() => {
this.allNotesCount_ = this.countAllNotes();
});
break;
}
})
);
}
public get allLocalRootTags(): SNTag[] {