router
router copied to clipboard
Router inserts into outlet second instance of main-menu
[original by @DemiusAcademius, copied from https://github.com/vaadin/flow/issues/8989#issuecomment-693193337]
I use client-side Vaadin router and found small issue.
I use path
{ path: '/(.*)', component: 'main-menu' } for fullscreen menu. If router show menu for path /ui/billing/production/indications (There is no component for this path yet ) and I use
Router.go("/ui/billing") for update path in chrome
Router inserts into outlet second instance of main-menu
My client-side code example in https://github.com/sia-interface/common-frontend;
routes in src/app/routes.ts
RouterListenerService in src/app/core/internal/services/router-listener-service.ts
router outlet in component src/app/core/internal/components/main-component/advanced-router.ts
main layout in component src/app/core/internal/components/main-component/main-layout.ts
In main-menu ( src/app/core/internal/components/main-menu/main-menu.ts
) I detect if component for route not exists and go to main path:
if (segements.length > pathSegmentIndex + 1) {
NOTIFICATION_SERVICE.notificate('info','Nu există încă nicio implementare pentru acest element de meniu')
const pathname = ENVIRONMENT.baseUrl + "/" + pathSegment
window.history.replaceState(null, "", pathname)
ROUTER_LISTENER_SERVICE.handleNewRoute(pathname)
}
But I want use Router.go(pathname)
without call window.history and ROUTER_LISTENER_SERVICE