aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2019-11-08 20:12:01 +0200
committerHenry Jameson <me@hjkos.com>2019-11-08 20:12:01 +0200
commita38d16273d19e6d6ee4b8066039bc3658f8db9b5 (patch)
tree047b8ab55ea3c31ce6a6a8421e48307e203f26ce /src
parent0dcb696e26dfcf97ad46e533ed4797bc9364fc01 (diff)
fix search not working, use computer property instead of state
Diffstat (limited to 'src')
-rw-r--r--src/components/emoji_picker/emoji_picker.js24
1 files 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