Fix release build: box CallPanel's in-call subtree to avoid recursion limit
Mesh calling's nested Show/For inside ChatShell's own Show inlined as a type parameter, blowing rustc's query recursion limit during the wasm release build (CI: "queries overflow the depth limit!"). Splitting the in-call view into its own component and type-erasing both CallPanel branches with .into_any() keeps the type shallow instead of raising the crate-wide limit.
This commit is contained in:
+52
-27
@@ -472,45 +472,70 @@ fn CallPanel(room: Memo<String>, me: String) -> impl IntoView {
|
||||
|
||||
view! {
|
||||
<div class="call-panel">
|
||||
<Show
|
||||
when=move || in_call.get()
|
||||
fallback=move || {
|
||||
{move || {
|
||||
if in_call.get() {
|
||||
view! {
|
||||
<CallActive
|
||||
local_video_ref=local_video_ref
|
||||
call_state=call_state.get_value()
|
||||
on_leave=on_leave
|
||||
/>
|
||||
}
|
||||
.into_any()
|
||||
} else {
|
||||
view! {
|
||||
<button class="call-join" on:click=on_join>
|
||||
"☎ join call"
|
||||
</button>
|
||||
}
|
||||
.into_any()
|
||||
}
|
||||
>
|
||||
<div class="call-active">
|
||||
<div class="video-grid">
|
||||
<video
|
||||
class="video-tile video-tile-local"
|
||||
node_ref=local_video_ref
|
||||
autoplay=true
|
||||
muted=true
|
||||
playsinline=true
|
||||
></video>
|
||||
<For
|
||||
each=move || call_state.get_value().peer_streams()
|
||||
key=|(id, _)| id.clone()
|
||||
children=move |(_id, stream)| {
|
||||
view! { <PeerVideoTile stream=stream/> }
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<button class="call-leave" on:click=on_leave>
|
||||
"⏏ leave call"
|
||||
</button>
|
||||
</div>
|
||||
</Show>
|
||||
}}
|
||||
</div>
|
||||
}
|
||||
.into_any()
|
||||
}
|
||||
#[cfg(not(feature = "hydrate"))]
|
||||
{
|
||||
let _ = (room, me);
|
||||
view! { <div class="call-panel"></div> }
|
||||
view! { <div class="call-panel"></div> }.into_any()
|
||||
}
|
||||
}
|
||||
|
||||
/// The in-call subtree (video grid + leave button), split out of
|
||||
/// `CallPanel` so its `<For>`-over-peers view doesn't get inlined as a type
|
||||
/// parameter of `CallPanel`'s own `if`/`else` branch - that inlining is what
|
||||
/// was blowing the compiler's query recursion limit once mesh calling's
|
||||
/// nested `Show`/`For` landed inside `ChatShell`'s own `Show`.
|
||||
#[cfg(feature = "hydrate")]
|
||||
#[component]
|
||||
fn CallActive(
|
||||
local_video_ref: NodeRef<leptos::html::Video>,
|
||||
call_state: crate::webrtc::CallState,
|
||||
on_leave: impl Fn(leptos::ev::MouseEvent) + 'static,
|
||||
) -> impl IntoView {
|
||||
view! {
|
||||
<div class="call-active">
|
||||
<div class="video-grid">
|
||||
<video
|
||||
class="video-tile video-tile-local"
|
||||
node_ref=local_video_ref
|
||||
autoplay=true
|
||||
muted=true
|
||||
playsinline=true
|
||||
></video>
|
||||
<For
|
||||
each=move || call_state.peer_streams()
|
||||
key=|(id, _)| id.clone()
|
||||
children=move |(_id, stream)| {
|
||||
view! { <PeerVideoTile stream=stream/> }
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<button class="call-leave" on:click=on_leave>
|
||||
"⏏ leave call"
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user