From a38d16273d19e6d6ee4b8066039bc3658f8db9b5 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Fri, 8 Nov 2019 20:12:01 +0200 Subject: [PATCH] fix search not working, use computer property instead of state --- src/components/emoji_picker/emoji_picker.js | 24 ++++++--------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/src/components/emoji_picker/emoji_picker.js b/src/components/emoji_picker/emoji_picker.js index 76d1f26b..a31adb63 100644 --- a/src/components/emoji_picker/emoji_picker.js +++ b/src/components/emoji_picker/emoji_picker.js @@ -24,10 +24,8 @@ const EmojiPicker = { showingStickers: false, groupsScrolledClass: 'scrolled-top', keepOpen: false, - customEmojiBuffer: (this.$store.state.instance.customEmoji || []) - .slice(0, LOAD_EMOJI_BY), + customEmojiBufferSlice: LOAD_EMOJI_BY, customEmojiTimeout: null, - customEmojiCounter: LOAD_EMOJI_BY, customEmojiLoadAllConfirmed: false } }, @@ -81,32 +79,21 @@ const EmojiPicker = { return } - this.customEmojiBuffer.push( - ...this.filteredEmoji.slice( - this.customEmojiCounter, - this.customEmojiCounter + LOAD_EMOJI_BY - ) - ) + this.customEmojiBufferSlice += LOAD_EMOJI_BY this.customEmojiTimeout = window.setTimeout(this.loadEmoji, LOAD_EMOJI_INTERVAL) - this.customEmojiCounter += LOAD_EMOJI_BY }, startEmojiLoad (forceUpdate = false) { const bufferSize = this.customEmojiBuffer.length const bufferPrefilledSane = bufferSize === LOAD_EMOJI_SANE_AMOUNT && !this.customEmojiLoadAllConfirmed const bufferPrefilledAll = bufferSize === this.filteredEmoji.length - if (forceUpdate || bufferPrefilledSane || bufferPrefilledAll) { + if ((bufferPrefilledSane || bufferPrefilledAll) && !forceUpdate) { return } if (this.customEmojiTimeout) { window.clearTimeout(this.customEmojiTimeout) } - set( - this, - 'customEmojiBuffer', - this.filteredEmoji.slice(0, LOAD_EMOJI_BY) - ) - this.customEmojiCounter = LOAD_EMOJI_BY + this.customEmojiBufferSlice = LOAD_EMOJI_BY this.customEmojiTimeout = window.setTimeout(this.loadEmoji, LOAD_EMOJI_INTERVAL) }, continueEmojiLoad () { @@ -152,6 +139,9 @@ const EmojiPicker = { this.keyword ) }, + customEmojiBuffer () { + return this.filteredEmoji.slice(0, this.customEmojiBufferSlice) + }, askForSanity () { return this.customEmojiBuffer.length >= LOAD_EMOJI_SANE_AMOUNT && !this.customEmojiLoadAllConfirmed