DioxusLabs / dioxus

Fullstack GUI library for web, desktop, mobile, and more.
https://dioxuslabs.com
Apache License 2.0
19.33k stars 736 forks source link

Fix for Counters sample code in Readme #2213

Closed ekanna closed 3 months ago

ekanna commented 3 months ago

For leptos code, there is no need for Memorization here. As memorization of the values of the text nodes in the renderer already happens.

ealmloff commented 3 months ago

For leptos code, there is no need for Memorization here. As memorization of the values of the text nodes in the renderer already happens.

This doesn't appear to be the case in the latest commit of leptos main. As I understand it, Leptos doesn't use a virtual dom so nodes are not automatically memorized. Here is the behavior when running your modification. Each time I change any of the counter values, each text node is rerendered:

https://github.com/DioxusLabs/dioxus/assets/66571940/79eb06df-0245-4fd7-ab81-72ed71e48085

Notice the 4 text for the first counter is rerendered even though the count doesn't change