mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] runtime: don't emit async hook warnings when cancelled/destroyed
Previously, the async hook warning that's emitted when async hooks take too long to resolve would be emitted even if the component was destroyed or cancelled. We used to check if the node's fiber was still the current fiber as a proxy for cancellation, but this is insufficient in the case where an app might be destroyed. This commit also wraps the content of some of the warning tests into a try/finally block so that a failure of these tests doesn't pollute setTimeout and console.warn and cause other tests to timeout one after another.
This commit is contained in:
committed by
Géry Debongnie
parent
e6c3b62ef0
commit
fddb1ec924
@@ -28,7 +28,7 @@ function wrapError(fn: (...args: any[]) => any, hookName: string) {
|
||||
result.catch(() => {}),
|
||||
new Promise((resolve) => setTimeout(() => resolve(TIMEOUT), 3000)),
|
||||
]).then((res) => {
|
||||
if (res === TIMEOUT && node.fiber === fiber) {
|
||||
if (res === TIMEOUT && node.fiber === fiber && node.status <= 2) {
|
||||
console.warn(timeoutError);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user