You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The idea is that you only have to return a new State if something has changed between updates. This works quite efficiently for small widgets, however can be quite expensive for larger widgets.
A possible solution is to instead return an Option<Box<FnMut(&mut Self::State)>>. With this change, the Widget::update signature might look something like this:
This way, instead of returning an entirely new state, we return a function that can mutate the state that already exists, reducing large allocations etc for larger widgets.
Concerns
It would be nice if we didn't have to Box the function that we're returning, however I'm unsure if it's possible to make an API that doesn't require it (I think we'd need HKT or something).
Any suggestions or alternatives for handling this problem in a nicer way are welcome!