Conversation
hayleigh-dot-dev
left a comment
There was a problem hiding this comment.
I think this solution is less clear than the previous immediate parameter to dispatch? We know the only source of immediate renders would be an attribute/property change or a context provide, I think that would be clearer what do you think?
attribute, property and context updates
|
The idea behind the counter was that we really want to always render on animation frame; this solution does not work when other frameworks trigger updates though, so I think always rendering synchronously after attribute/property/context changes is an ok compromise. I don't really like how this is rendering the component for every attribute/property that got changed, should be do something about that? |
Yeah I agree but I'm not super sure there's much we can do about it? I thought about queuing a microtask so all attribute (etc) change messages get batch-processed but then does this introduce some weird very niche timing edge cases for the component im not sure. |
If a component's view renders another component, this child component will receive a property or attribute change event synchronously, but then queue an animation frame one frame later.
This change introduces a global counter keeping track of nested updates like this and renders the child component synchronously instead if that happens, removing that one frame delay.