Skip to content

Commit

Permalink
fix: smart tag selection issue
Browse files Browse the repository at this point in the history
  • Loading branch information
moughxyz committed Mar 6, 2021
1 parent 01c35e4 commit af1a369
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/assets/javascripts/views/notes/notes_view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ class NotesViewCtrl extends PureViewCtrl<unknown, NotesState> {
* an index is roughly O(n^2).
*/
private reloadNotesDisplayOptions() {
const tag = this.appState.selectedTag!;
const tag = this.appState.selectedTag;
const searchText = this.getState().noteFilter.text.toLowerCase();
const searchQuery = searchText ? {
query: searchText,
Expand All @@ -337,7 +337,7 @@ class NotesViewCtrl extends PureViewCtrl<unknown, NotesState> {
const criteria = NotesDisplayCriteria.Create({
sortProperty: this.state.sortBy! as CollectionSort,
sortDirection: this.state.sortReverse! ? 'asc' : 'dsc',
tags: [tag],
tags: tag ? [tag] : [],
includeArchived: this.getState().showArchived!,
includePinned: !this.getState().hidePinned!,
searchQuery: searchQuery
Expand Down
8 changes: 2 additions & 6 deletions app/assets/javascripts/views/tags/tags_view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,8 @@ class TagsViewCtrl extends PureViewCtrl<unknown, TagState> {
this.selectTag(tag as SNTag);
}
} else if (data.item!.content_type === ContentType.SmartTag) {
this.application.createTemplateItem(
ContentType.SmartTag,
data.item!.content as PayloadContent
).then(smartTag => {
this.selectTag(smartTag as SNSmartTag);
});
const matchingTag = this.getState().smartTags.find(t => t.uuid === data.item!.uuid);
this.selectTag(matchingTag as SNSmartTag);
}
} else if (action === ComponentAction.ClearSelection) {
this.selectTag(this.getState().smartTags[0]);
Expand Down

0 comments on commit af1a369

Please sign in to comment.