Open joernroeder opened 4 years ago
I'm noticing that route-changed events are triggered even if the machine gets initialized on that particular route. This leads to duplicate actions on state entry and invocations of services at the target route.
route-changed
I've isolated the behavior in this sandbox: https://codesandbox.io/s/xstate-router-forked-fyff8
my suggestion is to omit the route-changed event and not trigger it if the route did not change or the previous event was xstate.init.
xstate.init
Thanks, @joernroeder.
Any updates on this?
bump
I'm noticing that
route-changed
events are triggered even if the machine gets initialized on that particular route. This leads to duplicate actions on state entry and invocations of services at the target route.I've isolated the behavior in this sandbox: https://codesandbox.io/s/xstate-router-forked-fyff8
my suggestion is to omit the
route-changed
event and not trigger it if the route did not change or the previous event wasxstate.init
.