You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, rendering an island directly in another panics (ex: OuterFailing). The only way around this is to render via children (ex: OuterWorking).
This can be problematic as it uses up the child prop, and the slot solution to this is incompatible with islands. As a workaround I have various "island wrappers" which wrap a component in an empty island component, but it can get quite messy.
Perhaps what I'm attempting is an anti-pattern and nesting islands should be best avoided?
use leptos::*;#[island]pubfnCommonIsland() -> implIntoView{let val = RwSignal::new(0);view!{
<div>
{move || format!("CommonIsland value is {}", val.get())}
<button on:click=move|_| val.update(|x| {*x += 1})>Click</button>
</div>
}}#[island]pubfnOuterWorking(children:Children) -> implIntoView{let val = RwSignal::new(0);view!{
<>
<div>
{move || format!("outer value is {}", val.get())}
<button on:click=move|_| val.update(|x| {*x += 1})>Click</button>
</div>
{children()}
</>
}}#[island]pubfnOuterFailing() -> implIntoView{let val = RwSignal::new(0);view!{
<>
<div>
{move || format!("outer value is {}", val.get())}
<button on:click=move|_| val.update(|x| {*x += 1})>Click</button>
</div>
<CommonIsland/>
</>
}}#[component]pubfnExample() -> implIntoView{view!{
<OuterFailing/>
<OuterWorking>
<CommonIsland/>
</OuterWorking>
<CommonIsland/>
}}
The text was updated successfully, but these errors were encountered:
Perfectly reasonable bug report. It's not likely I'll have the time to investigate it further in the near future (say, before mid-April) but would appreciate any help you can give in understanding the cause.
(Oh I should add: It is likely this will be fixed in 0.7, which is where I'm spending most of my energy, as the hydration works completely differently. I will tag this with 0.7 to make sure it is closed in that version if not before.)
Handling this removes the panic and the island works as expected, however hydration warnings remain. My knowledge of the inner works of Leptos are limited to the last hour, so I can only offer so much until I learn more!
Currently, rendering an island directly in another panics (ex:
OuterFailing
). The only way around this is to render via children (ex:OuterWorking
).This can be problematic as it uses up the child prop, and the
slot
solution to this is incompatible with islands. As a workaround I have various "island wrappers" which wrap a component in an empty island component, but it can get quite messy.Perhaps what I'm attempting is an anti-pattern and nesting islands should be best avoided?
The text was updated successfully, but these errors were encountered: