Add into_vnode temporary logic for more things
This commit adjusts how rsx! works, making it more forgiving with signals. Notably, we add the temporaries to if chains too.
This commit is contained in:
3 files changed
+23
-10
No files matched your search
@@ -126,8 +126,7 @@ impl ToTokens for BodyNode {
|
||||
}),
|
||||
BodyNode::RawExpr(exp) => tokens.append_all(quote! {
|
||||
{
|
||||
use ::dioxus::core::IntoDynNode;
|
||||
let ___nodes =(#exp).into_vnode(__cx);
|
||||
let ___nodes = (#exp).into_vnode(__cx);
|
||||
___nodes
|
||||
}
|
||||
}),
|
||||
@@ -146,7 +145,6 @@ impl ToTokens for BodyNode {
|
||||
// And then we can return them into the dyn loop
|
||||
tokens.append_all(quote! {
|
||||
{
|
||||
use ::dioxus::core::IntoDynNode;
|
||||
let ___nodes =(#expr).into_iter().map(|#pat| { #renderer }).into_vnode(__cx);
|
||||
___nodes
|
||||
}
|
||||
@@ -155,7 +153,10 @@ impl ToTokens for BodyNode {
|
||||
BodyNode::IfChain(chain) => {
|
||||
if is_if_chain_terminated(chain) {
|
||||
tokens.append_all(quote! {
|
||||
__cx.make_node(#chain)
|
||||
{
|
||||
let ___nodes = (#chain).into_vnode(__cx);
|
||||
___nodes
|
||||
}
|
||||
});
|
||||
} else {
|
||||
let ExprIf {
|
||||
@@ -209,7 +210,10 @@ impl ToTokens for BodyNode {
|
||||
});
|
||||
|
||||
tokens.append_all(quote! {
|
||||
__cx.make_node(#body)
|
||||
{
|
||||
let ___nodes = (#body).into_vnode(__cx);
|
||||
___nodes
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user