dom-expressions
dom-expressions copied to clipboard
Respect order of directives against dynamic attributes
Currently, directives are always guaranteed to run first, regardless if the dynamic attribute is declared first. We can consider this issue in the future however we can't do this right now considering that dom-expressions does not do true fine-grained attributes, as dynamic attributes are grouped into a single effect rather than their own independent effects. With ordered directives, it requires these dynamic attributes to either be split into their own independent effects or their group sequences (longest sequence of dynamic attributes before and after a directive, much like mergeProps
is right now.), but of course we don't want this right now as this trades the creation/memory cost against the update cost.
Yeah it might be interesting adding a first run type mechanism. There is complexity there, but maybe a simple is first sort of check could allow us to run these things in order inside the effect if necessary. The cost of doing one extra check each time isn't going to sink us.
Being optimistic, I'd say we could probably generate the effects first before the directives, so that the directives are guaranteed to run after all dynamic attributes has been set.