Skip to content

Commit

Permalink
[m100 cherrypick] Ensure that emoji search is updated when emoji are …
Browse files Browse the repository at this point in the history
…added to the picker

When we use the polymer observer, it doesn't trigger the update since the array object hasn't changed.  Change the observer so that it depends on the array length so that it is always called.

Test to follow

(cherry picked from commit 0e6d77b)

Bug: b:219358661
Change-Id: I2e2a20d8cdd2de624b7d0392c0d6198f12206561
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3511648
Reviewed-by: Keith Lee <keithlee@chromium.org>
Reviewed-by: Curtis McMullan <curtismcmullan@chromium.org>
Commit-Queue: John Palmer <jopalmer@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#980402}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3530467
Cr-Commit-Position: refs/branch-heads/4896@{#623}
Cr-Branched-From: 1f63ff4-refs/heads/main@{#972766}
  • Loading branch information
John Palmer authored and Chromium LUCI CQ committed Mar 17, 2022
1 parent 26bc026 commit 361139c
Showing 1 changed file with 4 additions and 2 deletions.
Expand Up @@ -36,7 +36,7 @@ export class EmojiSearch extends PolymerElement {
/** @private {!Array<!EmojiVariants>} */
emojiList: {
type: Array,
computed: 'computeEmojiList(emojiData)',
computed: 'computeEmojiList(emojiData,emojiData.length)',
observer: 'onEmojiListChanged'
},
/** @private {!Array<!EmojiVariants>} */
Expand Down Expand Up @@ -189,9 +189,11 @@ export class EmojiSearch extends PolymerElement {
* 1) Remove duplicates.
* 2) Remove groupings.
* @param {!EmojiGroupData} emojiData
* @param {number} emojiDataLength Used to trick polymer into calling this
* when the emojidata is updated via push
* @return {!Array<!EmojiVariants>}
*/
computeEmojiList(emojiData) {
computeEmojiList(emojiData, emojiDataLength) {
return Array.from(
new Map(emojiData.map(group => group.emoji).flat(1).map(emoji => {
// The Fuse search library in ChromeOS doesn't support prefix
Expand Down

0 comments on commit 361139c

Please sign in to comment.