Closed mondeja closed 7 months ago
Hey thanks for this. I don't understand the motivation behind this change though. What's the reasoning here?
See the documentation about Memo
s in Leptos: https://docs.rs/leptos_reactive/0.6.5/leptos_reactive/signal_prelude/prelude/struct.Memo.html
Memos have a certain overhead compared to derived signals. In most cases, you should create a derived signal. But if the derivation calculation is expensive, you should create a memo.
😄 I know about this documentation. But if you read carefully you see that there are cases where memos are preferred.
I think you're definitely correct about changing to derived signals in the sorting functions I'm not so sure about the other ones. While thinking about it I'm actually considering changing other "from" conversions to memos as well because usually the stuff that depends on these reactive elements is rather expensive. Although I'm not sure how that compares to the memo overhead.
What do you think?
Use
impl Fn() -> T + 'static
instead ofimpl Fn(Option<&T>) -> T + 'static
when possible.