perf(NcEmojiPicker): open x1.5-x2 faster + doesn't impact page loading #6467
+185
−117
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Improving
NcEmojiPicker
: part 3 of 3☑️ Resolves
emoji-mart-vue-fast
🥱 Boring details | Part 1: initial load 👇
NcEmojiPicker
requires creatingEmojiIndex
with blocks the main thread for about 100ms or more!We already improved it by:
setup
(not blocking initial Nextcloud app loading)However, it still blocks the main thread app to 100ms once there is the picker on the page...
Improvement (except Safari) - using
requestIdleCallback
.In the best case - no blocking anymore at all.
In the worth case (it's Safari, or EmojiPicker renders initially) - works as in the past.
🥱 Boring details | Part 2: opening 👇
Opening
NcEmojiPicker
is slow... But why? 🤔NcPopover
is quite fast (30ms)emoji-mart-vue-fast
is relatively acceptable (50-60ms)NcPopover
emoji-mart-vue-fast
~30ms
~60ms
But opening
NcEmojiPicker
=NcPopover + emoji-mart-vue-fast
is 🐌 SLOW, up to:It looks like
floating-vue (NcPopover)
first renders everything, when makes it "hiddenly visible) to get size and calculate position, and then renders it visually. It causes unneeded reflow, slightly blocking the process (even on optimized reopening, when everything is in DOM already).A solution - mount
NcPopover
with dummy empty div with the same size, and then renderemoji-mart-vue-fast
into a prepared container.🖼️ Screenshots
Useless gifs. Better to test in real app like Talk
🏁 Checklist
next
requested with a Vue 3 upgrade