When using a <base href> element, router.baseURL correctly retrieves the right value.
However, when trying to call Router.go(relativePath), no route is found.
Calling Router.go(document.querySelector('base')?.href + relativePath) does work as a workaround.
Description of the bug
When using a
<base href>
element,router.baseURL
correctly retrieves the right value. However, when trying to callRouter.go(relativePath)
, no route is found. CallingRouter.go(document.querySelector('base')?.href + relativePath)
does work as a workaround.Minimal reproducible example
See https://github.com/blindnet-io/privacy-components-web/pull/84
Router.go
with the workaround: https://github.com/blindnet-io/privacy-components-web/blob/ad9649ab9f5c254a35a38375dbe1194be39a7ba0/demos/devkit-simple-tutorial/src/views/BackOffice.js#L10-L18Expected behaviour
When defining the following route:
And a base href:
Calling
Router.go('/myroute')
should find and load the associated route.Actual behavior
Only
Router.go('/my/subdir/myroute')
works (adding the base href manually).Versions: