Skip to content

Decide component-script execution-order guarantees and dependency APIs #145

Closed

Description

@JuroOravec

(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/onServerRender callbacks, Vue setup()/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

  1. changed the title [-]Overlap component-script downloads and clarify execution-order guarantees[/-] [+]Decide component-script execution-order guarantees and dependency APIs[/+] on Sep 24, 2026
  2. added
    next-sprint
    on Oct 28, 2026
  3. added
    v0.9.0
    and removed
    next-sprint
    on Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    v0.9.0

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions