@@ -1625,6 +1625,13 @@ function makeRootFiber(node) {
1625
1625
fibersInError . delete ( current ) ;
1626
1626
fibersInError . delete ( root ) ;
1627
1627
current . appliedToDom = false ;
1628
+ if ( current instanceof RootFiber ) {
1629
+ // it is possible that this fiber is a fiber that crashed while being
1630
+ // mounted, so the mounted list is possibly corrupted. We restore it to
1631
+ // its normal initial state (which is empty list or a list with a mount
1632
+ // fiber.
1633
+ current . mounted = current instanceof MountFiber ? [ current ] : [ ] ;
1634
+ }
1628
1635
}
1629
1636
return current ;
1630
1637
}
@@ -1741,6 +1748,7 @@ class RootFiber extends Fiber {
1741
1748
const node = this . node ;
1742
1749
this . locked = true ;
1743
1750
let current = undefined ;
1751
+ let mountedFibers = this . mounted ;
1744
1752
try {
1745
1753
// Step 1: calling all willPatch lifecycle hooks
1746
1754
for ( current of this . willPatch ) {
@@ -1760,7 +1768,6 @@ class RootFiber extends Fiber {
1760
1768
node . _patch ( ) ;
1761
1769
this . locked = false ;
1762
1770
// Step 4: calling all mounted lifecycle hooks
1763
- let mountedFibers = this . mounted ;
1764
1771
while ( ( current = mountedFibers . pop ( ) ) ) {
1765
1772
current = current ;
1766
1773
if ( current . appliedToDom ) {
@@ -1781,6 +1788,15 @@ class RootFiber extends Fiber {
1781
1788
}
1782
1789
}
1783
1790
catch ( e ) {
1791
+ // if mountedFibers is not empty, this means that a crash occured while
1792
+ // calling the mounted hooks of some component. So, there may still be
1793
+ // some component that have been mounted, but for which the mounted hooks
1794
+ // have not been called. Here, we remove the willUnmount hooks for these
1795
+ // specific component to prevent a worse situation (willUnmount being
1796
+ // called even though mounted has not been called)
1797
+ for ( let fiber of mountedFibers ) {
1798
+ fiber . node . willUnmount = [ ] ;
1799
+ }
1784
1800
this . locked = false ;
1785
1801
node . app . handleError ( { fiber : current || this , error : e } ) ;
1786
1802
}
@@ -5604,7 +5620,7 @@ function compile(template, options = {
5604
5620
}
5605
5621
5606
5622
// do not modify manually. This file is generated by the release script.
5607
- const version = "2.5.1 " ;
5623
+ const version = "2.5.2 " ;
5608
5624
5609
5625
// -----------------------------------------------------------------------------
5610
5626
// Scheduler
@@ -6082,6 +6098,6 @@ TemplateSet.prototype._compileTemplate = function _compileTemplate(name, templat
6082
6098
export { App , Component , EventBus , OwlError , __info__ , batched , blockDom , loadFile , markRaw , markup , mount , onError , onMounted , onPatched , onRendered , onWillDestroy , onWillPatch , onWillRender , onWillStart , onWillUnmount , onWillUpdateProps , reactive , status , toRaw , useChildSubEnv , useComponent , useEffect , useEnv , useExternalListener , useRef , useState , useSubEnv , validate , validateType , whenReady , xml } ;
6083
6099
6084
6100
6085
- __info__ . date = '2024-11-26T08:42:41.633Z ' ;
6086
- __info__ . hash = '7fc552e ' ;
6101
+ __info__ . date = '2024-12-02T15:51:07.157Z ' ;
6102
+ __info__ . hash = '1c5b6f2 ' ;
6087
6103
__info__ . url = 'https://github.com/odoo/owl' ;
0 commit comments