Skip to content
docsv0.31.1

RenderEffect

A cross-component render effect: a component's `handle()` DECLARES that ANOTHER component should be re-painted, and the framework does the rest (greenhouse decisions/0189, evidence/0491). This is the standardized shape of the `effects` seam that {@see \Milpa\Live\ValueObjects\InteractionResult} left open ("shape is action/effect-type defined, not standardized here"). A handler returns one of these; the {@see \Milpa\Live\Http\LiveEndpoint} renders the named target component with the given props and puts its HTML into the response, and the client swaps the target component's root — no imperative JS. So an agent or a human declares BEHAVIOUR (on this interaction, re-paint that component) instead of wiring callbacks by hand. With `$state` — the target's CURRENT signed envelope, as the page holds it — the endpoint re-renders the target from that state instead of mounting it fresh from `$props` (greenhouse decisions/0211): a target that has been interacted with keeps what it had. An envelope that fails verification is never used; the endpoint falls back to the fresh mount.

RenderEffect::__construct()

public function __construct(string $target, string $component, array $props = [], ?string $state = null):

Parameters

Parameters of __construct()
NameTypeDescription
$targetstringthe componentId of the component to re-paint
$componentstringthe component name to render into the target
$propsarray<string, mixed>the props to mount the target with (used when there is no `$state`)
$state(string | null)the target's current signed state envelope to re-render from, or null to mount fresh

RenderEffect::toArray()

public function toArray(): array

The effect as the array that travels in {@see \Milpa\Live\ValueObjects\InteractionResult::$effects}; `state` is present only when given.