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
Why not create nodes by List.map? #224
Comments
It's a bit complicated, but it's due to the way Blazor's rendering algorithm works. In short, each insertion is associated with a sequence number. These numbers must be consistent between two consecutive renders for the algorithm to work. If you insert items using something like |
Thank you for the fast reply. It seems then that in my case (lists of constant length) I can ignore it. |
Related question: let forEachi (items: 'T list) (mkNode: int32 -> 'T -> Node) : Node =
forEach {0..items.Length-1} (fun i -> mkNode i items.[i]) |
@akhansari It makes sense, although this implementation is not really optimal, because let forEachi items mkNode =
forEach (Seq.mapi mkNode items) id |
The documentation warns against using
List.map
to create a list of Nodes and recommendsforEach
instead. Why is this? As far as I can see,forEach
creates the list in a way that does not differ from howList.map
would do it.(I do understand the need for using
cond
, inserting anempty
node instead of just dropping a node.)The text was updated successfully, but these errors were encountered: