Skip to content

Commit 105e0fd

Browse files
Design tier-2 vue component delivery via httpVueLoader URL mode
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent b75e141 commit 105e0fd

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

notes.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,40 @@ Measured before building tier-1 — and it would have been the wrong thing:
308308
- Minor: _remove_buffers/_separate_buffers walk all state values per open (~1.4% process);
309309
comm-creation machinery ~3.8%.
310310

311+
## Tier-2 template/component delivery design (investigated 2026-06-12, late)
312+
313+
Code reading (ipyvue repo, js/src + python) makes this much cheaper than feared:
314+
315+
Mechanics today:
316+
- `VueTemplate.template = Union([Instance(Template), Unicode()])` — template-as-widget already
317+
exists (used by template_file/get_template via per-kernel template_registry under solara).
318+
- JS `TemplateModel` is a trivial WidgetModel; `VueTemplateRenderer` reads `template` SYNCHRONOUSLY
319+
at component build (async here needs renderer surgery).
320+
- JS `VueComponentModel` (the register_components path = leasing's ~30 components) feeds
321+
`httpVueLoader(componentString)` — and the vendored httpVueLoader RETAINS its original HTTP
322+
mode: `httpVueLoader.load(url, name)`, `httpRequest`, parseComponentURL, <style src> fetching.
323+
URL mode = Vue ASYNC component factory, natively supported by Vue (no sync problem).
324+
325+
Plan (minimal viable, VueComponent path first — exactly the leasing hot spot):
326+
1. ipyvue python: `VueComponent.component_url` trait; `register_component_from_string` consults a
327+
pluggable module-level `url_provider(content) -> url|None`; if a URL comes back, sync
328+
component_url instead of the source (component=None).
329+
2. ipyvue JS VueComponentModel: if component_url set -> `Vue.component(name, httpVueLoader.load(url))`
330+
(existing code path); string mode unchanged.
331+
3. solara: content-hash store + immutable-cached route (e.g. /_solara/static/vue/<sha256>.vue),
332+
installed as the url_provider at server start. Content-addressed URL = browser disk cache
333+
across page loads => first load: 30 parallel HTTP/2 fetches off the websocket; repeat loads:
334+
zero bytes, zero parse on the ws path.
335+
4. Phase 2: same treatment for Template widgets (template_url) — needs VueTemplateRenderer to go
336+
async (placeholder + re-render on change:template, hot-reload listener machinery already exists).
337+
5. Compat: provider unset (jupyter/lab, voila) -> exact current behavior; solara pins matching
338+
ipyvue python+JS via its bundle, so no runtime negotiation needed.
339+
Cost: ipyvue py (small), ipyvue JS (small for VueComponent, moderate for Template), solara endpoint
340+
(small), the real tax is the bundle rebuild chain (jupyter-vue -> solara-vuetify-app -> version bumps).
341+
342+
Also noted: ipyvue get_template re-reads the .vue file from disk on every call even on registry
343+
hits (to support dev watching) — harmless under OS cache, but could be gated on a dev flag.
344+
311345
## Stash (possible bugs / questionable behavior found along the way)
312346

313347
- pandas 3.0 re-render on equal DataFrame (see above) — env pin papering over it for now.

0 commit comments

Comments
 (0)