https://squint-cljs.github.io/squint/?src=gzip%3AH4sIAAAAAAAAE3VRwY7bIBC9%2BytenFaCQ5KeOVSVVv2CPVreioVJTYuBhSGrVZR%2Fr2zcSJHaQQJmmPdm3iBCwaxd6AChMr1Vl6kDMPQTcyrqdKIyH8t0CjrEiWf%2FydJZV889lC5YIqOUXScsnVFYM0FojjOuysQamDK%2B3P4mBFSHYeyA%2FQLEy7J3wKCsu6xVVcoEkfKhcMa3lU%2BO7cWFVBlXddG%2BEsTmbzlLyt1UDO1xL8q7TrutL11KNNhw4vAVn6FY55%2FEaKRS3rZar5U5BlxVDMY78xt7kXLAA11NdjnuMl0wUt7WRvqnFTTTrh%2FHu%2FZMwVJu%2BoUnxpBjZIiYIX6Vk42mzhT4%2BFYpfzyTJ8Mxo9%2FrlPpHgasJGzk%2BIk0mzfTd0%2BKht%2B7yLyAgCvEOB2fR%2F4ccj8Sv0X4cU6ZEwUrZfgTimCl5behpct5mCmh6qpNy%2FXFt7eFds5m2iSnVRrDoPwcMP7CuEaLFG2q7%2FwGpnEDCmQIAAA%3D%3D The obvious drawback to this is that focus is lost on re-render...
Did you make it with your own brain though @borkdude ๐ง๐งโโ๏ธ๐งโโ๏ธ???? ๐ฌ
@raymcdermott I asked some ideas to ChatGPT, but I take responsibility for all code written ;)
๐ฎ๐ปโโ๏ธ
โ
You may proceed ๐
Joking aside, the blog you wrote shows your thinking and itโs all explicable. You lack features by comparison to other implementations
I bet it didnโt take too long to produce the first version
Lacking features is solvable when you start with a tiny base
And maybe the bloat comes from what should really be another lib
lacking features is by design. this is just to show "how it works". I'd use this for my blog for example, 3.5kb is nothing. Enterprise apps may have performance issues with this
e.g. I measured a table of 10k items and shuffling the items takes 500ms. but not all enterprise apps may have tables with 10k elements
and react uses :key for this which is pretty easy to implement probably
Getting anything 100% on point is gonna be a pain but I love the scrappy fiddle!
And from what you say, thereโs a simple solution. My thinking is that enterprise apps are late adopters, unless theyโre apps youโre writing ๐
I'm just excited that my scrappy fiddle "reagent" can run my scrappy reagent fiddles from a decade back without any problems :)
I did discover one more edge case. event handlers should be removed + inserted when the node changes event handlers. e.g. this:
(if ...
[:button {:on-click something}]
[:button {:on-click other}])
which is fixed in 0.0.9I wonder how eucalypt solves the problem of not having to remount node in case of a click handler
going to try reagent
yeah reagent (on top of react) is faster but also struggling when you get to 10k rows
๐คฃ
๐ช๐ผ
I recall there are some specialist React libraries for rendering very large tables (even millions of rows) that do some deeply weird things with the DOM.
An interesting comparison would be with a vanilla JS implementation adding 1000s of rows like that.
js-framework-benchmark or whatever it's called does that. It's pretty straight forward to implement (though a little finicky to set up). With it you can compare to practically anything out there.
@chris358 React Virtualized it's called I think, I've used that in the past
BTW if you end up implementing a more complete Reagent clone I will be more than happy to shelve Eucalpyt. It's not something I actually want to build, more like a compulsion I am following because it seems like it should exist. Maybe the test suite could come in handy too.
Looks like an early version of Eucalypt before all those confounded edge cases. ๐
Add some CSS transitions and conditionally move elements around, and you'll find some more cases ๐
Need to add a test that requires clicking on this and see if an LLM can solve it: https://seangrindal.com/writing/cheeky-button
I have conditionally moved elements by clicking the show button ;)
Pretty impressive ๐
You have to always return the same number of nodes, but if you do it works remarkably well ๐
the whole thing: 3.87 kB gzip :)
let's try a css transition, I hardly ever use them
maybe blending the hiccup generation with the patching would make sense so I can even avoid creating elements if they aren't used anyway
This is sounding familiar ๐
I'm sitting here wondering why I have so much code
(made a few fixes to the patching thing with respect to false attributes etc)
Please donโt shelve Euxalypt! I just was fiddling around to see if I could build something very minimal. What I have now I more close to Replicant than Reagent and I donโt think Iโm going to implement full Reagent. I am deferring people who want this to Euxalypt
No I won't shelve it. I just meant to say I'm more interested in the end result than the project itself. I'll try to get the rest of the Preact tests ported over.
https://clojurians.slack.com/archives/C8NUSGWG6/p1761335380837639