question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Context menu does not render after router navigation

See original GitHub issue

Issue type

I’m submitting a … (check one with “x”)

  • bug report
  • feature request

Issue description

Current behavior: Following an OAuth2 flow similar to the samples, the user context menu in the header component does not drop-down upon click and yields the following stack trace.

main.a72571efe1e9cccd811a.js:69949 ERROR TypeError: Cannot read property ‘appendChild’ of null at NbOverlayContainerAdapter.push…/node_modules/@nebular/theme/components/cdk/adapter/overlay-container-adapter.js.NbOverlayContainerAdapter._createContainer (main.a72571efe1e9cccd811a.js:105528) at NbOverlayContainerAdapter.push…/node_modules/@angular/cdk/esm5/overlay.es5.js.OverlayContainer.getContainerElement (main.a72571efe1e9cccd811a.js:11222) at NbOverlay.push…/node_modules/@nebular/theme/components/cdk/overlay/mapping.js.NbOverlay.createHostElement (main.a72571efe1e9cccd811a.js:106080) at NbOverlay.push…/node_modules/@nebular/theme/components/cdk/overlay/mapping.js.NbOverlay.create (main.a72571efe1e9cccd811a.js:106055) at NbOverlayService.push…/node_modules/@nebular/theme/components/cdk/overlay/overlay.js.NbOverlayService.create (main.a72571efe1e9cccd811a.js:106832) at NbContextMenuDirective.push…/node_modules/@nebular/theme/components/context-menu/context-menu.directive.js.NbContextMenuDirective.createOverlay (main.a72571efe1e9cccd811a.js:108818) at NbContextMenuDirective.push…/node_modules/@nebular/theme/components/context-menu/context-menu.directive.js.NbContextMenuDirective.show (main.a72571efe1e9cccd811a.js:108798) at SafeSubscriber._next (main.a72571efe1e9cccd811a.js:108855) at SafeSubscriber.push…/node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.__tryOrUnsub (main.a72571efe1e9cccd811a.js:137557) at SafeSubscriber.push…/node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.next (main.a72571efe1e9cccd811a.js:137495)

Expected behavior: The user context menu will show upon click after router navigation.

Steps to reproduce: The callback code that’s triggering the issue is in the akveo/nebular repo. https://github.com/akveo/nebular/blob/7e68c20a92dbe8f86ff728f0df6d4e771a0b7408/src/playground/with-layout/oauth2/oauth2-callback.component.ts

I even tried a variation of the existing logic by running it within OnInit and OnDestroy with the appropriate subscription disposable. It yields the same results. The only thing that makes the user context menu to start rendering again is a hard-refresh of the browser.

Related code:

Other information:

npm, node, OS, Browser

Node, npm: `node --version` (v11.4.0) and `npm --version` (6.4.1)
OS: macOS Mojave
Browser: Chrome

Angular, Nebular

    "@nebular/auth": "3.1.0",
    "@nebular/bootstrap": "3.1.0",
    "@nebular/security": "3.1.0",
    "@nebular/theme": "3.1.0",

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:28

github_iconTop GitHub Comments

7reactions
Ungolimcommented, Jul 1, 2019

This issue effectively impedes the usage of the otherwise excellent ContextMenu and Dialog components and it should not be postponed any further

6reactions
NileshDabicommented, Oct 8, 2019

I also have the same problem with nebular toastr. Its not working in my lazy loaded feature module.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React router doesn't render component after second click for ...
Navigation problem What I mean. When visiting your site, the active menu item is the "Home" item, which is in an active state...
Read more >
Creating a React context menu - LogRocket Blog
Explore how to create a React context menu, the shortcuts to activate right-click menus, and how to create a custom context menu Hook....
Read more >
React Router Tutorial – How to Render, Redirect, Switch, Link ...
Create the Navbar Component​​ Let's start by creating the navigation bar for our app. This component will make use of the <NavLink />...
Read more >
Angular Navigation: How Routing & Redirects Work in Angular ...
This guide covers how routing works in an app built with Ionic and Angular. The Angular Router is one of the most important...
Read more >
Adding navigation - Angular
Associate a URL path with a componentlink. The application already uses the Angular Router to navigate to the ProductListComponent . This section shows...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found