← UI Rendering & SSR

UI RENDERING & SSR FEATURE

Block Isolation

Two identical blocks on the same page run independently — scoped DOM, scoped JS, no conflicts.

Feature Guide

A quick orientation block that answers the essential questions: what this feature does, how it works, why it matters, and the key concepts behind it.

What this does

Two identical blocks on the same page run independently — scoped DOM, scoped JS, no conflicts.

Scoped Instances

Same slot class, separate runtime state

Two countdown blocks reuse the same widget template and client module, but each instance keeps its own timer and DOM scope.

Scoped island

Countdown widget

Isolated runtime

This widget runs its own timer state and restart flow without touching the other instance.

Timer A 30s

Waiting for the first backend sync tick.

Scoped island

Countdown widget

Isolated runtime

This widget runs its own timer state and restart flow without touching the other instance.

Timer B 60s

Waiting for the first backend sync tick.

DOM scoping data-instance block isolation independent timers

Verified against Semitexa Ultimate 2026.09.19.1020

Block Isolation

Two identical blocks on the same page run independently — scoped DOM, scoped JS, no conflicts. Repeated deferred blocks stay isolated through per-instance data attributes and scoped DOM.

How it works

Each deferred block instance receives a unique data-instance attribute when it renders. Client-side behavior scopes its DOM queries to the component root instead of using global selectors. This means two instances of the same slot class can run on the same page with independent state, independent timers, and no interference between their DOM trees.

Key mechanisms

  • DOM scoping — each block instance owns its own DOM subtree, identified by data-instance.
  • data-instance — unique per-render attribute that client scripts use as the scope root.
  • block isolation — slot handler, template, and client module all treat each instance as independent.
  • independent timers — two countdown or refresh loops running the same slot code do not share state.

Why this matters

Without per-instance scoping, placing the same deferred widget twice on a page causes client scripts to interfere with each other — shared class names, shared DOM queries, and racing timers. Block isolation makes duplication safe by default, so the same slot can appear any number of times on one page without custom disambiguation code.

© Edsger W. Dijkstra: "Simplicity is prerequisite for reliability."

Countdown Slot Secondary page region
<?phpdeclare(strict_types=1);namespace App\Application\Resource\Slot;use Semitexa\Ssr\Attribute\AsSlotResource;#[AsSlotResource(    handle: 'dashboard',    slot: 'dashboard.sidebar',    template: '@project/dashboard/deferred-sidebar.html.twig',    deferred: true,)]final class DeferredSidebarSlot{    /**     * @param list<string> $items     */    public function __construct(        public readonly string $headline,        public readonly array $items,    ) {}}

Support Semitexa
Built for developers who prefer control over magic. Your support helps keep it fast, open, and evolving.

Donate via PayPal