3 ms·
I am finally figured out how to do it with Surplus :) Its documentation is super confusing, first it talks that there are no lifecycle hooks, but then I see lif
by localvoid 8y ago
I am finally figured out how to do it with Surplus :) Its documentation is super confusing, first it talks that there are no lifecycle hooks, but then I see lifecycle hooks[1], then it talks that there are no diffing, and then I see inefficient diffing algo[2].
It won't be so hard to solve use cases that I am talking about. Just create an index(HashMap), implement simple diffing algo that updates hashmap index and doesn't care about item positions, then from the ordered list generate a new list with values from the hashmap index, and then apply this inefficient diff algo that uses object identity to track objects[2].
1. https://github.com/ismail-codar/surplus-material/blob/3dce38090cd5c5b32e99d001471f11fe4ab65ea6/components/button.tsx#L47 https://github.com/ismail-codar/surplus-material/blob/3dce38...
2. https://github.com/adamhaile/S-array/blob/1046fca3032691d4ef3d6e0cb471fa620cf02077/es/index.js#L127-L176 https://github.com/adamhaile/S-array/blob/1046fca3032691d4ef...