mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] reactivity: clear callbacks at destroy time instead of unmount
This commit is contained in:
committed by
Aaron Bohy
parent
0728c8333d
commit
93f2c1d766
+2
-2
@@ -1,4 +1,4 @@
|
||||
import { onWillUnmount } from "./component/lifecycle_hooks";
|
||||
import { onWillDestroy } from "./component/lifecycle_hooks";
|
||||
import { ComponentNode, getCurrent } from "./component/component_node";
|
||||
import { batched, Callback } from "./utils";
|
||||
|
||||
@@ -245,7 +245,7 @@ export function useState<T extends object>(state: T): Reactive<T> | NonReactive<
|
||||
node,
|
||||
batched(() => node.render())
|
||||
);
|
||||
onWillUnmount(() => clearReactivesForCallback(render));
|
||||
onWillDestroy(() => clearReactivesForCallback(render));
|
||||
}
|
||||
const render = batchedRenderFunctions.get(node)!;
|
||||
const reactiveState = reactive(state, render);
|
||||
|
||||
Reference in New Issue
Block a user