carloslfu / xstate-router

XState Router. Add routes to your XState machine.
MIT License
112 stars 16 forks source link

Adopt parameterized routes to current values #2

Closed stephanpelikan closed 5 years ago

stephanpelikan commented 5 years ago

If one sends an event which targets a state having a parameterized route and the context reflects this parameters in the "match" property like it would be as typing a parameterized route into the browsers location bar then the route shown in the browsers location bar does no show the current parameters but the placeholders instead.

I adopted the sandbox example (https://codesandbox.io/s/xstate-router-5r5r7) like this:

Loading https://5r5r7.codesandbox.io/#/dashboard/4711/data gives

State: {"dashboard":{"loggedIn":"data"}}

as expected. If you load https://5r5r7.codesandbox.io/#/about and press the "Next" button you will get

https://5r5r7.codesandbox.io/#/dashboard/**:id**/data

as location instead of https://5r5r7.codesandbox.io/#/dashboard/**815**/data

I've added a sandbox-fork which show this: https://codesandbox.io/s/xstate-router-no0r3