Hi there, I'm currently using createActorContext but I've run into an issue where when my provider gets unmounted, the actor is stopped so any child components can no longer use it to do any sort of clean up via something like:
useEffect(() => {
return () => {
actorRef.send({ type: 'CLEANUP' });
}
}, [])
If the above effect is executed in a child of the provider, the machine is already stopped. If I try to hoist that effect to where the provider is rendered, there is no available reference to the actorRef.
Any suggestion on how to get around this?
Ideally this can be defined on the machine itself. Maybe something like a onBeforeStop similar to onDone.