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 e77ac8d
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
Expand Up @@ -8,15 +8,16 @@ import {
SNSmartTag,
SNTag,
TagMutator,
UuidString
UuidString,
ApplicationEvent,
} 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 e77ac8d

Please sign in to comment.