Commit a38d1627 authored by HJ's avatar HJ 🐼

fix search not working, use computer property instead of state

parent 0dcb696e
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment