Skip to content

Commit

Permalink
fix: reload note counts
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentsenta committed Jan 5, 2022
1 parent f543bbe commit e8e7cdb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
17 changes: 15 additions & 2 deletions app/assets/javascripts/ui_models/app_state/tags_state.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
import { confirmDialog } from '@/services/alertService';
import { STRING_DELETE_TAG, STRING_MISSING_SYSTEM_TAG } from '@/strings';
import {
ApplicationEvent,
ComponentAction,
ContentType,
MessageData,
SNApplication,
SNSmartTag,
SNTag,
TagMutator,
UuidString
UuidString,
} from '@standardnotes/snjs';
import {
action,
computed,
makeAutoObservable,
makeObservable,
observable,
runInAction
runInAction,
} from 'mobx';
import { WebApplication } from '../application';
import { FeaturesState, SMART_TAGS_FEATURE_NAME } from './features_state';
Expand Down Expand Up @@ -146,6 +147,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[] {
Expand Down

0 comments on commit e8e7cdb

Please sign in to comment.