-
-
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
Enable PartialEq for all virtual dom types #3206
Conversation
Visit the preview URL for this PR (updated for commit 4b751c7): https://yew-rs-api--pr3206-enable-vcomp-vgpur25w.web.app (expires Mon, 10 Apr 2023 03:03:12 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 |
Size Comparison
|
Benchmark - SSRYew Master
Pull Request
|
// 1 initial render + 3 update steps | ||
assert_eq!(obtain_result_by_id("test-0"), "total: 4"); | ||
// 1 initial render + 1 magic | ||
assert_eq!(obtain_result_by_id("test-0"), "total: 2"); |
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.
This demonstrates that this pull request is working in reducing unnecessary renders.
Unfortunately, this does increase the bundle size as it includes a eq method on each component. |
Description
This pull request enables partial eq on all virtual dom types, so re-render can be avoided if VNode matches.
Previously, VNode comparison always evaluate to false when VComp is present and this will result in a re-render for any Html that contains a VComp.
This pull request addresses this issue.
This pull request also fixes a regression introduced in #3050 where PartialEq is wrongly evaluated via pointer comparison.
Checklist