This behaviour caused problems if one of the action functions was used in something like a React useEffect.
Since the reference to the function changes every time the machine state changes.
This could lead to an infinite loop.
Instead pass a proxy that references the latest selector values to the actions function. This way it can be created only once when the machines view is first rendered
This behaviour caused problems if one of the action functions was used in something like a React
useEffect
. Since the reference to the function changes every time the machine state changes.This could lead to an infinite loop.
Instead pass a proxy that references the latest selector values to the actions function. This way it can be created only once when the machines view is first rendered
Fixes Improve action handling #2