diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-09-25 10:47:37 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-09-25 10:47:37 +0200 |
| commit | 0bdce359c0bf19fa98f1b7f9975be32704abe1f0 (patch) | |
| tree | c67c24b9751c3d8063fc9806a5d6650a3b8c03fb /packages/meshbay-hub/src/meshbay_hub/static/apps.js | |
| parent | 950f4aa6d107e127fb6dc0579beedbff0e6f1af5 (diff) | |
| download | meshbay-0bdce359c0bf19fa98f1b7f9975be32704abe1f0.tar.gz | |
feat(client): fetch the media apps, the player, settings and search on first use
apps.js registers Videos, Music, Photos and every settings pane through
lazy.js; the group page does the same for the video player and the
settings panel, and the shell for the search page. The first download
goes from 49 modules / 386 KB gzip to 37 / 289 KB; opening Music now
fetches music-app.js and media-tiles.js and nothing of Videos.
test_first_load_is_lean holds the eager graph; test_spa_imports checks
that every on-demand load names an export that exists.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/static/apps.js')
| -rw-r--r-- | packages/meshbay-hub/src/meshbay_hub/static/apps.js | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/apps.js b/packages/meshbay-hub/src/meshbay_hub/static/apps.js index eec2158..8ae4db4 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/apps.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/apps.js @@ -1,14 +1,19 @@ import { ChatPanel } from './chat-app.js'; import { FilesPanel } from './files-app.js'; -import { VideoApp } from './video-app.js'; -import { MusicApp } from './music-app.js'; -import { PhotosApp } from './photos-app.js'; -import { ChatSettings } from './chat-app-settings.js'; -import { VideoSettings } from './video-app-settings.js'; -import { MusicSettings } from './music-app-settings.js'; -import { PhotoSettings } from './photos-app-settings.js'; -import { HelloWorldApp } from './helloworld-app.js'; -import { HelloWorldSettings } from './helloworld-app-settings.js'; +import { lazy } from './lazy.js'; + +// Chat and Files open with the group; every other app, and every settings +// pane, is fetched the first time it is shown (lazy.js) — a member who only +// chats never downloads the Videos app. +const VideoApp = lazy(() => import('./video-app.js'), 'VideoApp'); +const MusicApp = lazy(() => import('./music-app.js'), 'MusicApp'); +const PhotosApp = lazy(() => import('./photos-app.js'), 'PhotosApp'); +const ChatSettings = lazy(() => import('./chat-app-settings.js'), 'ChatSettings'); +const VideoSettings = lazy(() => import('./video-app-settings.js'), 'VideoSettings'); +const MusicSettings = lazy(() => import('./music-app-settings.js'), 'MusicSettings'); +const PhotoSettings = lazy(() => import('./photos-app-settings.js'), 'PhotoSettings'); +const HelloWorldApp = lazy(() => import('./helloworld-app.js'), 'HelloWorldApp'); +const HelloWorldSettings = lazy(() => import('./helloworld-app-settings.js'), 'HelloWorldSettings'); /** * Whether apps marked `dev` are shown. Opt in once with `?dev=1`, off with |