[FIX] reactivity: only call clearReactivesForCallback once on unmount

This commit is contained in:
Samuel Degueldre
2021-11-26 16:10:42 +01:00
committed by Géry Debongnie
parent 99740f9993
commit 922dab8e8f
+1 -1
View File
@@ -233,9 +233,9 @@ export function useState<T extends object>(state: T): Reactive<T> {
node,
batched(() => node.render())
);
onWillUnmount(() => clearReactivesForCallback(render));
}
const render = batchedRenderFunctions.get(node)!;
const reactiveState = reactive(state, render);
onWillUnmount(() => clearReactivesForCallback(render));
return reactiveState;
}