-
Notifications
You must be signed in to change notification settings - Fork 9
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
Alternative representation of keyed-children #85
Comments
See also #84 (comment). |
Just to be sure I understand: this requires key-diffing to work? |
Not sure I understand :) can you explain what is "key-diffing" ? |
If every value is a new key-value list, you have to find the diff of those lists to know which items are new/updated/deleted? |
Oh, right! It would be based on the keys. I think of it as maintaining a sort of "key pool", where you add resources the pool based on their key. If a key already exists in the pool, you can reuse it, and if a resource sits unused in the pool, it can be cleaned up. |
Not sure how the current solution works, but there could be performance implications, right? I think this is something which catches react users off guard |
The current solution works pretty much like I described. It maintains a pool of elements, indexed by key. Here's an example:
Hosted here: https://armanbilge.github.io/calico/todomvc/index.html If you add a large number of todo items, but only modify one of them (e.g. add/remove/check/uncheck/edit name) then performance should still be fast, since it is not rebuilding and re-rendering the list, it is performing a precise update on the modified key. This issue simply proposes an alternative type signature to access that machinery. |
Awesome, thanks for the explanation. Will you offer both styles? |
Yes, well, your question about this issue made me rethink if we should do it. So the current signature works with a However, the signature proposed in that issue muddies that a bit. Signal[List[(K, Resource[IO, HTMLElement])]] What happens if a user updates the signal with something like:
This is highly confusing, because the same key has now been associated with two different So I'm less sure now if this is a good idea. |
another good idea from @kubukoz. Something like
The text was updated successfully, but these errors were encountered: