mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] concurrency: do not render delayed fibers when cancelled
Previously, if a fiber was delayed because one of its ancestors was rendering, and that fiber was not a root fiber, it would be rendered after all its ancestors had finished rendering even if one of those ancestor renderings cancelled it. This commit fixes that by simply checking that a delayed fiber is still its component node's current fiber before rendering it.
This commit is contained in:
committed by
Géry Debongnie
parent
41344ef4ec
commit
41f1262eb7
+13
-9
@@ -138,7 +138,7 @@ const steps: string[] = [];
|
||||
export function logStep(step: string) {
|
||||
steps.push(step);
|
||||
}
|
||||
export function useLogLifecycle(key?: string) {
|
||||
export function useLogLifecycle(key?: string, skipAsyncHooks: boolean = false) {
|
||||
const component = useComponent();
|
||||
let name = component.constructor.name;
|
||||
if (key) {
|
||||
@@ -147,20 +147,24 @@ export function useLogLifecycle(key?: string) {
|
||||
logStep(`${name}:setup`);
|
||||
expect(name + ": " + status(component)).toBe(name + ": " + "new");
|
||||
|
||||
onWillStart(() => {
|
||||
expect(name + ": " + status(component)).toBe(name + ": " + "new");
|
||||
logStep(`${name}:willStart`);
|
||||
});
|
||||
if (!skipAsyncHooks) {
|
||||
onWillStart(() => {
|
||||
expect(name + ": " + status(component)).toBe(name + ": " + "new");
|
||||
logStep(`${name}:willStart`);
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
expect(name + ": " + status(component)).toBe(name + ": " + "mounted");
|
||||
logStep(`${name}:mounted`);
|
||||
});
|
||||
|
||||
onWillUpdateProps(() => {
|
||||
expect(name + ": " + status(component)).toBe(name + ": " + "mounted");
|
||||
logStep(`${name}:willUpdateProps`);
|
||||
});
|
||||
if (!skipAsyncHooks) {
|
||||
onWillUpdateProps(() => {
|
||||
expect(name + ": " + status(component)).toBe(name + ": " + "mounted");
|
||||
logStep(`${name}:willUpdateProps`);
|
||||
});
|
||||
}
|
||||
|
||||
onWillRender(() => {
|
||||
logStep(`${name}:willRender`);
|
||||
|
||||
Reference in New Issue
Block a user