Skip to content

route-changed event triggered after xstate.init on the same route #26

Open
@joernroeder

Description

@joernroeder

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 was xstate.init.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions