Skip to content
docsv0.31.1

StateEffect

A shared-signal effect: a handler DECLARES a new value for a NAMED shared signal, and every element that reads it updates — one truth, many projections (greenhouse decisions/0189). Where {@see RenderEffect} re-paints one target and {@see DispatchEffect} signals one target, this one has NO target: it sets a value in the client's reactive signals store, and everything bound to `<key>` (a topbar badge, a side panel, a chip — `x-text="$store.milpa['<key>']"`) tracks it. The value is the single source of truth projected across the UI; declaring it from the backend keeps the projection consistent everywhere.

StateEffect::__construct()

public function __construct(string $key, ?mixed $value):

Parameters

Parameters of __construct()
NameTypeDescription
$keystring
$value?mixed

StateEffect::toArray()

public function toArray(): array

The effect as the array that travels in {@see \Milpa\Live\ValueObjects\InteractionResult::$effects}.