mirror of
https://github.com/Matysh/houseplan-card
synced 2026-10-02 21:01:21 +00:00
perf(bundle): load the space-card GUI editor lazily to keep #744 under the initial View budget (#744)
The floor-geometry key of #744 (+~143 B gzip) put the initial View graph at 301 097 B gzip, 31 B over the absolute 301 066 B wall in scripts/bundle-budget.mjs. The comment over that wall says the next growth is paid by moving code into lazy graphs, not by raising the budget. `src/space-card.ts` imported its Lovelace GUI config editor (`src/space-editor.ts`, the `houseplan-space-card-editor` element) statically, so every View paid for a form only the dashboard editor opens. `getConfigElement()` now imports it on demand, exactly as `houseplan-card.getConfigElement()` already does for `./editor`; Home Assistant awaits the returned promise. The editor's dependencies (lit, i18n, space-geometry) stay in the shared chunk, so the new `space-editor-*.js` chunk holds only the element itself (~1.1 KB gzip). Measured: initial View 301 097 -> 300 489 B gzip (-608 B), headroom to the 301 066 B budget 577 B. The beta ceiling (300 142 B, band 2 000 B above it, #699) and the budget are unchanged; lazy editor/onboarding graphs are not touched. Issue: #744 User-Visible: no Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018qZfe7YS4rqEMKoVeS3GKd
This commit is contained in:
+4
-2
@@ -46,7 +46,6 @@ import {
|
||||
createGlowRuntimeState, disposeGlowRuntime,
|
||||
type GlowRuntimeHost, type GlowRuntimeState,
|
||||
} from './glow-scene';
|
||||
import './space-editor';
|
||||
import {
|
||||
DECOR_ASSETS_API_VERSION, decorAssetIds, resolveDecorAssets, type DecorAsset,
|
||||
} from './decor-assets';
|
||||
@@ -276,7 +275,10 @@ class HouseplanSpaceCard extends LitElement {
|
||||
this._connHooked = connection;
|
||||
}
|
||||
|
||||
public static getConfigElement() {
|
||||
/** The Lovelace GUI editor is a lazy chunk, as for `houseplan-card` (#744):
|
||||
* only the dashboard editor asks for it, never the first View frame. */
|
||||
public static async getConfigElement() {
|
||||
await import('./space-editor');
|
||||
return document.createElement('houseplan-space-card-editor');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user