Skip to content

Commit

Permalink
Fixes scttcper#172
Browse files Browse the repository at this point in the history
  • Loading branch information
Spencer Moran committed Dec 8, 2019
1 parent 64c95cc commit f256e26
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/lib/picker/emoji-search.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,12 @@ export class EmojiSearch {
}

category.emojis.forEach(
emojiId => (pool[emojiId] = this.emojiService.names[emojiId]),
emojiId => {
// Need to make sure that pool gets keyed
// with the correct id, which is why we call emojiService.getData below
let emoji = this.emojiService.getData(emojiId);
pool[emoji.id] = emoji;
}
);
});

Expand Down
4 changes: 3 additions & 1 deletion src/lib/picker/picker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,10 @@ export class PickerComponent implements OnInit {
this.categories.unshift(this.SEARCH_CATEGORY);
this.selected = this.categories.filter(category => category.first)[0].name;

const categoriesToLoadFirst = 3;
// Need to be careful if small number of categories
let categoriesToLoadFirst = Math.min(this.categories.length, 3);
this.setActiveCategories(this.activeCategories = this.categories.slice(0, categoriesToLoadFirst));

// Trim last active category
const lastActiveCategoryEmojis = this.categories[categoriesToLoadFirst - 1].emojis.slice();
this.categories[categoriesToLoadFirst - 1].emojis = lastActiveCategoryEmojis.slice(0, 60);
Expand Down

0 comments on commit f256e26

Please sign in to comment.