Load emoji properly on first showing

This commit is contained in:
Tusooa Zhu 2021-08-15 00:03:31 -04:00
parent ba1b006e05
commit 99a368dbb3
No known key found for this signature in database
GPG Key ID: 7B467EDE43A08224

View File

@ -58,7 +58,8 @@ const EmojiPicker = {
customEmojiBufferSlice: LOAD_EMOJI_BY, customEmojiBufferSlice: LOAD_EMOJI_BY,
customEmojiTimeout: null, customEmojiTimeout: null,
customEmojiLoadAllConfirmed: false, customEmojiLoadAllConfirmed: false,
groupLoadedCount: {} groupLoadedCount: {},
firstLoaded: false
} }
}, },
components: { components: {
@ -167,6 +168,13 @@ const EmojiPicker = {
} }
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['emoji-groups'].scrollTop = 0 this.$refs['emoji-groups'].scrollTop = 0
this.$nextTick(() => {
if (this.firstLoaded) {
return
}
this.triggerLoadMore(this.$refs['emoji-groups'])
this.firstLoaded = true
})
}) })
const bufferSize = this.customEmojiBuffer.length const bufferSize = this.customEmojiBuffer.length
const bufferPrefilledAll = bufferSize === this.filteredEmoji.length const bufferPrefilledAll = bufferSize === this.filteredEmoji.length