Router omits current route when navigating by name in shared subroute context
lucastanger opened this issue · comments
Reproduction
https://codesandbox.io/p/sandbox/icy-river-y3ppgk?file=%2Fsrc%2Fmain.js%3A14%2C6
Steps to reproduce the bug
- Open Codesandbox
- Ensure router is visiting "/random/static1"
- Click Button "Go to subroute"
- See router switching to "/random/static2/subroute/1"
Expected behavior
Router stays on route static1 and appends subroute
Actual behavior
Router is switching from static1 to static2 and then appends subroute
Additional information
While creating this issue, I realized that this could be caused due to the fact that the subroute is a "shared" property used by both route static1 and static2. I would expect that I can create new routes and append them to different routes as children, but keep the current active route as active.
router
--/:prop/static1
------------/:prop/static1/subroute/:id (aliased as 'subroute') <--- Switches from this to static2, while only submitting the name 'subroute'
--/:prop/static2
------------/:prop/static2/subroute/:id (aliased as 'subroute')
names are uniques so you need to ensure that your two subroutes use different names instead of just subroute
for both of them