Skip to content

Commit aeed79c

Browse files
committed
[REL] v2.5.2
# v2.5.2 - [FIX] runtime: make error recovery more robust
1 parent 1c5b6f2 commit aeed79c

File tree

4 files changed

+23
-7
lines changed

4 files changed

+23
-7
lines changed

docs/owl.js

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,6 +1625,13 @@ function makeRootFiber(node) {
16251625
fibersInError.delete(current);
16261626
fibersInError.delete(root);
16271627
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+
}
16281635
}
16291636
return current;
16301637
}
@@ -1741,6 +1748,7 @@ class RootFiber extends Fiber {
17411748
const node = this.node;
17421749
this.locked = true;
17431750
let current = undefined;
1751+
let mountedFibers = this.mounted;
17441752
try {
17451753
// Step 1: calling all willPatch lifecycle hooks
17461754
for (current of this.willPatch) {
@@ -1760,7 +1768,6 @@ class RootFiber extends Fiber {
17601768
node._patch();
17611769
this.locked = false;
17621770
// Step 4: calling all mounted lifecycle hooks
1763-
let mountedFibers = this.mounted;
17641771
while ((current = mountedFibers.pop())) {
17651772
current = current;
17661773
if (current.appliedToDom) {
@@ -1781,6 +1788,15 @@ class RootFiber extends Fiber {
17811788
}
17821789
}
17831790
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+
}
17841800
this.locked = false;
17851801
node.app.handleError({ fiber: current || this, error: e });
17861802
}
@@ -5604,7 +5620,7 @@ function compile(template, options = {
56045620
}
56055621

56065622
// do not modify manually. This file is generated by the release script.
5607-
const version = "2.5.1";
5623+
const version = "2.5.2";
56085624

56095625
// -----------------------------------------------------------------------------
56105626
// Scheduler
@@ -6082,6 +6098,6 @@ TemplateSet.prototype._compileTemplate = function _compileTemplate(name, templat
60826098
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 };
60836099

60846100

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';
60876103
__info__.url = 'https://github.com/odoo/owl';

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@odoo/owl",
3-
"version": "2.5.1",
3+
"version": "2.5.2",
44
"description": "Odoo Web Library (OWL)",
55
"main": "dist/owl.cjs.js",
66
"module": "dist/owl.es.js",

src/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
// do not modify manually. This file is generated by the release script.
2-
export const version = "2.5.1";
2+
export const version = "2.5.2";

0 commit comments

Comments
 (0)