Repository navigation
Description
(GPT Astra 5.6 medium)
Scope
Decide whether Citry should retain its component-script execution-order guarantees or allow independent scripts to execute as soon as they are ready, and define how users express dependencies if those guarantees change.
Parallel downloading with unchanged execution order is being addressed separately in the current Vue migration work (#137). It does not require resolving this issue. “Parallel execution” here means relaxing ordering/allowing asynchronous initialization to overlap, not executing ordinary DOM JavaScript simultaneously on multiple threads.
Context
The initial-readiness investigation found eight component-behavior scripts followed by one shared compiled-template bundle loading almost serially. The chain spanned ~14 ms at both 140 and 1,400 outputs. Second-load “Browser + subsequent requests” measured 52.1 vs Nuxt's 38.3 ms at 140 outputs, and 159.1 vs 156.4 ms at 1,400. These are single local, HTTP-asset-cold observations, not a CPU profile.
That ~14 ms is the observed combined loading chain, not an estimate of savings from relaxing execution order. First measure concurrent downloads with ordered execution; only then quantify any additional opportunity from changing the execution contract.
Decisions needed
- Audit/document the existing promise that components earlier in HTML execute their JavaScript before later components. Confirm the parent-before-child rules, including slots, repeated types, initial pages, and server-rendered insertions. The current mounted loader follows manifest script order; this alone does not prove every HTML/instance-order guarantee.
- Distinguish deduplicated class/type script evaluation and options registration from per-instance
$component/onServerRendercallbacks, Vuesetup()/lifecycle hooks, and completion of asynchronous user work. - Compare retaining deterministic order with explicitly opting independent scripts into unordered execution. Determine which uses depend on globals or another component's initialization.
- If order is relaxed, provide a supported dependency/readiness mechanism, such as declared dependencies, promises/callbacks, or a module-import model. Do not make ad-hoc polling the required solution. Specify missing dependencies, cycles, failures, cancellation, and cleanup, plus migration guidance.
Completion criteria
Document the chosen guarantees and examples for dependent components; test parent/sibling/slot order and fragment updates; measure the incremental benefit over parallel downloads with ordered execution. Preserve registration checks, CSP/integrity handling, and explicit failure behavior.
Source pointers in #137: packages/py/citry/citry/_vue/client.js (loadTypeScript, primeInitialAssets, loadDefinition, callback coordination), _vue/serialization.py, and docs/design/performance_architecture_experiments.md.
Related: #35 (ESM and execution ordering), #10 (asset compiler).
Activity
[-]Overlap component-script downloads and clarify execution-order guarantees[/-][+]Decide component-script execution-order guarantees and dependency APIs[/+]docs(design): record the maintainer's decisions on whitespace parity …
docs(design): whitespace parity (#152) and script order (#145) for 0.…
feat(vue): guarantee script order and failure behaviour (#145)
test, docs: cover and document script order and failures (#145)
fix(vue): fold in review findings for script order (#145)
fix(vue): run callbacks of components shown during a server render's …
test(vue): cover components shown during server render callbacks and …
docs(design): mark script order as built and note implementation deta…
test(vue): read script tags with html.parser instead of a regex (#145)
feat(vue): guarantee script order and failure behaviour (#145) (#651)