Skip to content

Client CWV: defer tsjs bundle, CLS min-height injection, disableInitialLoad #854

Description

@aram356

Description

The 2026-07-05 performance and architecture review grouped three possible client performance changes: defer the main tsjs bundle, reserve slot space to reduce layout shift, and avoid duplicate initial ad requests. They need separate compatibility checks before implementation. The original 7.3 KB bootstrap size and “guaranteed CLS fix” are review-era assertions, not current measurements.

Current behavior

  1. The main tsjs bundle is still inserted synchronously near the start of <head> (html_processor.rs:317-349; tsjs.rs:15-44). Deferred integration modules are already supported separately. GPT also injects an inline bootstrap (integrations/gpt.rs:493-540), whose order-sensitive behavior must be preserved.
  2. No general per-slot min-height injection appears in the head-insert path. Slot formats are available in configuration, but responsive formats and unknown/variable creative heights need a sizing policy before a style can safely reserve space.
  3. GPT now has first-impression claims and handoff logic. The bootstrap refreshes reused publisher-owned slots to apply server-side targeting and avoids a second request for TS-owned slots when initial load is enabled (gpt_bootstrap.js:730-891). A blanket disableInitialLoad() call could alter publisher-owned behavior or leave slots blank. Duplicate requests should be measured on a specific call sequence before changing the load policy.

Proposed work

  • Bundle loading: Inventory code that must execute before publisher scripts. Keep that small bootstrap inline, defer only code proven safe to load later, and check script ordering across immediate and deferred integrations. Compare navigation timings and failure behavior before and after.
  • Slot reservation: Define how a slot's configured formats map to height across breakpoints, including fluid/unknown formats. Inject a narrowly scoped early style only where a safe reservation can be derived; test pages with and without matching slots and measure layout shift.
  • GPT initial load: Capture a reproducible publisher-owned-slot sequence and count native display/refresh requests, including hb_* targeting on the first impression. Fix any confirmed duplicate with the narrowest ownership-aware change. Evaluate disableInitialLoad() only if it preserves existing publisher setup and the required initial request for TS-owned slots.

Done when

  • A dependency inventory and browser test show the main bundle can defer without breaking early integration initialization or ad startup; otherwise record the blocking dependencies.
  • Slot-height rules and tests cover responsive and unknown formats, with measured layout-shift effect rather than a claimed guaranteed result.
  • A request-count test reproduces any duplicate GAM request, and the fix yields one intended initial request with server-side targeting for both TS-owned and publisher-owned slots.
  • Before/after page measurements report the actual CWV and ad-request effects.

Related

  • Original review: 2026-07-05 performance and architecture review, client-side web vitals items 1, 2, and 4; sequencing item 8 of 10.

Activity

  1. added this to the v1 milestone on Jul 7, 2026
  2. added theissue type on Jul 9, 2026
  3. modified the milestones: v1, 202609 on Sep 1, 2026
  4. modified the milestones: 202609, 202610 on Sep 26, 2026
  5. removed their assignment
    on Oct 24, 2026
  6. modified the milestones: 202610, 202611 on Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions