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.
The way we were loading emoji data was split into several parts:
bskyweb/static/emojis.2023.json
with the actual emoji data./static/js/emoji-mart-data.js
that loads that file and sets it towindow.emojiMartData
.polyfills
that injects that script.window.emojiMartData
at render time.This "worked" but in a confusing way:
if (!Intl.Segmenter)
condition, so it wasn't getting triggered in Chrome.<head>
because ourscripts.html
helper does that at build time.data={undefined}
to EmojiMart, it just fetches the data from jsdelivr CDN (which it did in local development).window.emojiMartData
during render is effectively a race condition since you don't know whether it's loaded by now or not.This changes the code to use an
async
function asdata
prop, per this example. Instead of PROD-onlybskyweb/static/
, I opted to make it a dynamic JS chunk which makes it easy to load it on demand without messing with the static file pipeline.Test plan
Observe emoji data loading on demand (when I open the picker).
Observe that it loads from our domain (not CDN).