From 93f2c1d76627724e041ef9ff64b81a2efac01a68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Mon, 24 Jan 2022 16:32:23 +0100 Subject: [PATCH] [FIX] reactivity: clear callbacks at destroy time instead of unmount --- src/reactivity.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/reactivity.ts b/src/reactivity.ts index c647e445..ba937c89 100644 --- a/src/reactivity.ts +++ b/src/reactivity.ts @@ -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(state: T): Reactive | NonReactive< node, batched(() => node.render()) ); - onWillUnmount(() => clearReactivesForCallback(render)); + onWillDestroy(() => clearReactivesForCallback(render)); } const render = batchedRenderFunctions.get(node)!; const reactiveState = reactive(state, render);