fix: tags state mobx warning (#821)

This commit is contained in:
Aman Harwara
2022-01-21 21:32:03 +05:30
committed by GitHub
parent 701b703466
commit 829a240f63

View File

@@ -8,7 +8,7 @@ import {
SNSmartTag, SNSmartTag,
SNTag, SNTag,
TagMutator, TagMutator,
UuidString UuidString,
} from '@standardnotes/snjs'; } from '@standardnotes/snjs';
import { import {
action, action,
@@ -16,7 +16,7 @@ import {
makeAutoObservable, makeAutoObservable,
makeObservable, makeObservable,
observable, observable,
runInAction runInAction,
} from 'mobx'; } from 'mobx';
import { WebApplication } from '../application'; import { WebApplication } from '../application';
import { FeaturesState, SMART_TAGS_FEATURE_NAME } from './features_state'; import { FeaturesState, SMART_TAGS_FEATURE_NAME } from './features_state';
@@ -148,7 +148,9 @@ export class TagsState {
appEventListeners.push( appEventListeners.push(
this.application.addNoteCountChangeObserver((tagUuid) => { this.application.addNoteCountChangeObserver((tagUuid) => {
if (!tagUuid) { if (!tagUuid) {
this.allNotesCount_ = this.application.allCountableNotesCount(); runInAction(() => {
this.allNotesCount_ = this.application.allCountableNotesCount();
});
} else { } else {
this.tagsCountsState.update([ this.tagsCountsState.update([
this.application.findItem(tagUuid) as SNTag, this.application.findItem(tagUuid) as SNTag,