-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove ToHtml trait #3453
remove ToHtml trait #3453
Conversation
Visit the preview URL for this PR (updated for commit 9c131ab): https://yew-rs--pr3453-rm-to-html-z2668i6x.web.app (expires Sat, 04 Nov 2023 09:57:34 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok now I get it why said making html cheap to clone would fix the issue. It's brilliant! I'm sorry I haven't look at the benchmarking yet...
let attr_value = AttrValue::from("foo"); | ||
|
||
let _ = html! { <Child>{&attr_value}</Child> }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh it would fix that one too? Excellent!
Size Comparison
✅ None of the examples has changed their size significantly. |
5e14b3c
Benchmark - SSRYew Master
Pull Request
|
I am not opinionated on how we convert a If
|
Can you share more details on that (link on a previous conversation maybe)? |
There wasn't a discussion. The pull request was #3289. |
Into<Html> and Display can't be implemented on the same type
This reverts commit 52f3c1f. These impls are fine now
Benchmark - coreYew Master
Pull Request
|
(I'm on it, please don't merge too fast) |
(There is more work to do but it's complicated so I will do it in another PR)
@@ -139,7 +139,7 @@ impl Component for App { | |||
{ &self.time } | |||
</div> | |||
<div id="messages"> | |||
{ for self.messages.iter().map(|message| html! { <p>{ message }</p> }) } | |||
{ for self.messages.iter().map(|message| html! { <p>{ *message }</p> }) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to fix that in a separate PR.
Related to yewstack/implicit-clone#37
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to do more changes but it will be a bit too extensive so I think I will make a separate PR after this one is merged.
I'm going to go ahead and merge this so you can work on your PR |
/// children.map(|children| { | ||
/// html! { | ||
/// <div class={classes!("container")}> | ||
/// {children} | ||
/// {children.clone()} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That one too looks weird. I will fix it in my future PR
* remove ToHtml trait * re-add display impls * make Vec::clone expilit * fix doc * fix conflicting impls Into<Html> and Display can't be implemented on the same type * update docs * blanket impl won't work here * bring back `Vec<VNode>: IntoPropValue<VNode>` * macro tests * Revert "fix conflicting impls" This reverts commit 52f3c1f. These impls are fine now * make examples compile * .clone() should be before .into() * Rc VList * Make use of ImplicitClone and AttrValue in example (There is more work to do but it's complicated so I will do it in another PR) * Impl ImplicitClone on VChild --------- Co-authored-by: Cecile Tonglet <[email protected]>
Description
This trait was a mistake. See the discussion in #3443
This pattern
fails because of missing trait impl for
Foo
:This blanket implementation is not possible
because this one exists:
#3431 makes VNode cheap to clone so it's
Into::into
isn't an issueChecklist