Elm solves this using keyed nodes, React using key attributes, but I didn't find anything similar in Fabulous. Did I miss something or is it not implemented yet?
No you are correct, nothing like this has been implemented.
Please see performance notes on current approaches to optimising performance - Currently list views are optimised for appending rather than prepending.
We accept PRs though if it something you need and fancy having a go at it 馃槃
The alternative is to play around with Layout.RaiseChild and Layout.LowerChild, but in an Elmish architecture that's something I don't really want to play around with.
I'll see if I have the time, energy and skills to put together a PR, thanks.
I think adding an equivalent to key nodes is an important part of "completing the picture" for Fabulous and bringing it on-par with React and Elm
With Fabulous and Fabulous.XamarinForms now separated, we will need to write a new framework agnostic view diffing algorithm.
It will lead to a lot of rewrite, we should take this chance to implement keyed nodes
For anyone looking for workarounds, using isVisible can achieve a partial effect.
Instead of:
View.StackLayout [
if condition then
View.BoxView Color.Aqua
View.BoxView Color.Yellow
]
use
View.StackLayout [
View.BoxView Color.Aqua |> isVisible condition
View.BoxView Color.Yellow
]
So that the view will not be destroyed and recreated whenever condition changes.
Closing. It is now available in 0.55 (still preview), albeit performance still need improvements before releasing it as stable.
Most helpful comment
I think adding an equivalent to key nodes is an important part of "completing the picture" for Fabulous and bringing it on-par with React and Elm