pub struct ComponentState {Show 13 fields
pub name: String,
pub parent: Option<String>,
pub effects: Map<String, Value>,
pub memo: Map<String, Value>,
pub provided_props: Option<Map<String, Value>>,
pub slot_fragments: Vec<String>,
pub children: Vec<Child>,
pub scripts: Vec<String>,
pub assets: Vec<String>,
pub islands: Map<String, Value>,
pub slots: Map<String, Value>,
pub errors: Map<String, Value>,
pub download: Option<Download>,
}Expand description
The state one component has within one request: what it rendered, and what it asks the browser to do.
Fields§
§name: StringThe component’s registered name, such as counter.
parent: Option<String>The ID of the component that rendered this one, when nested.
effects: Map<String, Value>Effects the component added, keyed by effect name: dispatches, listeners, url,
xjs, js, redirect, download, scripts, and the module keys.
memo: Map<String, Value>Memo entries the component added, such as lazy, isolate, with, async, html.
provided_props: Option<Map<String, Value>>The named params its parent passed this request, which a reactive prop reads back and an unchanged child skips on.
slot_fragments: Vec<String>The slot fragments this component stubbed a child with, sent so the browser can morph them.
children: Vec<Child>The nested components the component rendered, in render order.
scripts: Vec<String>The @script blocks this render ran, keyed by component name and template position.
assets: Vec<String>The @assets blocks this render ran, keyed the same way.
islands: Map<String, Value>The island fragments the component rendered, keyed by island name.
slots: Map<String, Value>The slot fragments the component rendered for its parent, keyed by slot name.
errors: Map<String, Value>The validate errors the component’s last validation produced.
download: Option<Download>The file the component asked the browser to download.
Implementations§
Source§impl ComponentState
impl ComponentState
Sourcepub fn push_effect(&mut self, name: &str, value: Value)
pub fn push_effect(&mut self, name: &str, value: Value)
Adds value to the effect name, keeping a list when it is one.