odoo / owl

OWL: A web framework for structured, dynamic and maintainable applications
https://odoo.github.io/owl/
Other
1.1k stars 332 forks source link

do not destroy new components with equivalent props if rerendered before being mounted #1577

Open ged-odoo opened 6 months ago

ged-odoo commented 6 months ago

While a template is being rendered, if Owl finds a new child component, it will create it.

<div>
    <C />
</div>

Now, if later (but before animation frame) the parent component is re-rendered, Owl will create a new RootFiber. To do this, it will check for the current rendering, and cancel all the current fibers. This will in turn destroy the new instance of C, because C has not been mounted yet.

This makes sense usually, because the sub component has been willStarted, and we don't want to execute onWillStart twice. However, in our case, C has no props. So, it would make sense to keep the same instance in this case (same applies for components with equivalent props).