0.29.0
elements man releases/v0-29-0Content passed to a template is created each time the template's <slot/>
renders it. This release and @elements/app 0.29.0 go together: upgrade the
package in every project after upgrading Elements.
Upgrade @elements/app
The compiler and @elements/app changed together. A project still on an older
@elements/app builds, but content passed to its templates does not render
correctly. In each project:
Terminalelements install @elements/app -u -json elements build -json
A project that pins @elements/app to an exact version changes the pin to
0.29.0 or later in config.jsoc first. Restart elements start after the
install.
Slot content is new each time
app/pages/home/template.ehtml<Panel open={open}> <Editor draft={draft}/> </Panel>
When Panel removes its <slot/> and renders it again, for example behind an
e:if, the content is created again. Editor is a new instance: its own state
starts over and its oninsert runs again. State the calling template owns
(draft here) is kept, since the caller was never removed.
Keep any state that has to outlive a close and reopen in the calling template,
and pass it down as an attribute. This already applied to content passed with
slot="name"; it now applies to all content passed to a template.