router icon indicating copy to clipboard operation
router copied to clipboard

Router inserts into outlet second instance of main-menu

Open bogdanudrescu opened this issue 4 years ago • 1 comments

[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

bogdanudrescu avatar Sep 17 '20 07:09 bogdanudrescu

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

DemiusAcademius avatar Sep 17 '20 11:09 DemiusAcademius