Skip to content
docsv0.1.0

RenderRequest

The input to {@see \Milpa\Live\Contracts\Rendering\ComponentRendererInterface::render()}. When `$state` is `null`, the renderer MUST mount the component fresh from `$props`/`$context`; when `$state` is given, the renderer renders that snapshot as-is (`$props` is then only consulted as a fallback for values not already captured in state — see e.g. {@see \Milpa\Live\Rendering\ViewModel\DashboardViewModelFields}'s meta-over-props precedence).

RenderRequest::__construct()

public function __construct(Milpa\Live\ValueObjects\ComponentContext $context, array $props = [], ?Milpa\Live\ValueObjects\StateSnapshot $state = null, Milpa\Live\ValueObjects\RenderTarget $target = Milpa\Live\ValueObjects\RenderTarget::HTML, array $options = []):

Parameters

Parameters of __construct()
NameTypeDescription
$contextComponentContextThe render-target-agnostic context to mount/render within.
$propsarray<string, mixed>Props to mount with, or to fall back to when `$state` is given.
$state(StateSnapshot | null)An already-mounted snapshot to render as-is, or `null` to mount fresh.
$targetRenderTargetWhich target this request is for; renderers MUST reject a request whose target they do not {@see \Milpa\Live\Contracts\Rendering\ComponentRendererInterface::supportsTarget()}.
$optionsarray<string, mixed>Target-specific rendering options (e.g. TUI's `width`/`focused`/`cursor`).