Closed UberMouse closed 1 year ago
Though maybe it would be best to instead always return a static actions object and instead use a proxy for the selectors, and pass that to actions so it's always reading the latest selector data via the proxy.
Closed by #25
Currently the result of the
buildActions
builder is cached until one of the following happensAnd then the selectors can change for the following reasons
Which means that the actions will change reference whenever the machines context is updated or the state is changed. This is not great for re-renders and makes the DX of using an action inside of a
useEffect
pretty awful. Can't refer to the action directly and need to use a ref that gets synchronized with the actions current reference.It seems like a solution to this would be to instead return a stable Proxy reference for actions and have that proxy forward the call to the current actions reference.