Repository navigation
perf(cards): load each card's visual editor only when it is opened - #1216
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
perf(cards): load each card's visual editor only when it is opened
Every dashboard used to download and parse all 30 card editors (about
190 KB of JavaScript) even though nobody opens an editor on a normal
visit. Each editor now lives in www/editors/-editor.js and the
card's getConfigElement() imports it on demand, carrying the card's
?v= version so an update still busts the cache, while the editor
strings load alongside it.
perf(locales): load only the strings each screen needs, and let the browser cache them
A dashboard used to download two whole translation catalogues on every
load (the user's language plus English, about 600 KB) with a URL that
changed each time, so the browser could never cache them. Each language
is now split into three bundles: the cards' strings, the card editors'
and the admin panel's. A dashboard fetches just its language's cards
bundle (about 70 KB), a card editor adds the editor bundle, and the
admin panel adds its own. The URLs carry the integration version, so
the browser keeps them until the next update.
The bundles are generated from the existing locales/.json files
by scripts/split_locales.py and committed, with missing wording filled
from the fallback language at build time, so translators still edit one
file per language. The admin panel now also redraws when its strings
arrive or the language changes, instead of waiting for its next update.
ci(locales): keep the split locale bundles in step with their sources
The Data files check now fails when a locale bundle is stale, and a
pre-commit hook (which pre-commit.ci also runs) regenerates them, so a
translator's pull request gets the bundles rebuilt for them. The
contributing guide and the Localization page say which files to edit.
Testing