diff --git a/src/react.tsx b/src/react.tsx index 142c313..2731acc 100644 --- a/src/react.tsx +++ b/src/react.tsx @@ -90,10 +90,11 @@ export function useSetup( invokeLifecycle(LifecycleHooks.MOUNTED) return () => { invokeLifecycle(LifecycleHooks.BEFORE_UNMOUNT) - scope.current?.cleanups.forEach(fn => fn()) + process.env.NODE_ENV !== 'development' + ? scope.current?.stop() + : scope.current?.cleanups.forEach(fn => fn()) invokeLifecycle(LifecycleHooks.UNMOUNTED) setMountState(false) - process.env.NODE_ENV !== 'development' && scope.current?.stop() } }, []) diff --git a/src/solid.tsx b/src/solid.tsx index 82e0754..cb11af3 100644 --- a/src/solid.tsx +++ b/src/solid.tsx @@ -126,9 +126,9 @@ export function useSetup( onCleanup(() => { invokeLifecycle(LifecycleHooks.BEFORE_UNMOUNT) + scope.stop() invokeLifecycle(LifecycleHooks.UNMOUNTED) setMountState(false) - scope.stop() }) return state as ReturnedSetup