No, tag and attributes stored in slots
array, in order. dynamicSlots
is additional array, which holds only dynamic slots, both from tag and from children (recursively). It's needed to manage mapping from slot to its value in ESX (look at ESX.getDynamicSlotValue
). So you still can just travers Element.slots and it gives you tag as first element, then named or spread slots, in order, for attributes. Same for children, but there is spread slots, text slots, anonymous slots (just value) or Elements.
- slot are just interpolations. I don't see any difference form current ESX
Main difference - it holds all actual values in template, both static and dynamic (which is interpolations in your case). And it do so for any value, including element tag, element properties and even static text too!
- maybe here I get what you mean by root element ... same reference, as opposite of a new instance ... is this the advantage? you update only attributes and children? this looks like the previous iteration but then again, conditional returns and list in arrays were not working as expected because the same root element was updated too many times. Not sure you solved this in there.
Root element is never updated. Any dynamic value get captured in ESX instance, and then, you can get value for dynamic slot in template, by calling esx.getDynamicSlotValue(someSlot). So, dynamic slots is just placeholders, and ESX instance then give you actual values for any of this slot. Everything is worked as intended, you can look at compiled output and grab the idea.
In ESX the ID is the same, and per each ID the tree structure is parsed and referenced only once
In my case, tree structure even created only once! But i need to make it lazy, so it will be created only when JSX is actually evaluated first time (now tree created eagerly on module import, not really good).
This is the topic I was after two replies ago: it's easy to speculate what's better ... but until you implement a library that shows it's better than current ESX approach and is capable of showing great performance and low heap consumption preserving correctness of this benchmark there's no point for me to argue that, or say it's not true, we're all talking hypothetical unless there is a library the beats udomsay using preact signals to compare apples to apples. Until that, I let you work on such library and I look forward to see results.
Yeah, of course. I just want to get some early responses, maybe i miss something now. Currently all your notes is already handled, so last piece of work is only lazy tree creation (and handling polyfill if here is already import from lib). It should be really trivial, and then I can start working on showcase.