-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Context menu does not render after router navigation #1136
Comments
Yep, having the same issue with NbPasswordAuthStrategy. [EDIT] The issue only occurs, if the
I investigated on that issue in the file
|
- proper routing for auth submodule - local NbAuthComponent to avoid oddities of multi NbLayout instances (error like in akveo/nebular#1136) -
Cannot reproduce it. Could you someone consolidate a reproducible example at https://stackblitz.com/github/akveo/nebular-seed? |
I can confirm this issue on Nebular 3.4.0 |
@Mubramaj, could you shed a bit more light, please? What would be the steps? Are there any changes to layout/routes/etc? Would really appreciate any help on this. |
I beleave that is something related to NbOverlayContainerAdapter._containerElement member (is showing null in vscode debugger). So, when it calls getContainerElement().appendChild throws the error! |
Someone got some palliative solution? |
This issue effectively impedes the usage of the otherwise excellent ContextMenu and Dialog components and it should not be postponed any further |
I have same issue when combined [Reproduce steps]
|
I have the same problem. |
I also have the same problem with nebular toastr. Its not working in my lazy loaded feature module. |
I still got the issue in version 4.5.0
|
3.6.2 seems to fix this issue |
no it does not, at least when there are lazy-loaded modules in the way
same here.. so frustrating, can't get around it with Context Menus, had to swap a different navigation menu system for production release |
@lepidotteri I used Nebular Auth and had to write a custom AuthComponent that doesn't use nebular/src/framework/auth/components/auth.component.ts Lines 16 to 33 in 1e1a293
From my understanding the menu only works correctly if the |
Thank you @niklasravnsborg, I had suspected as much; I didn't go that far but I did change the auth-module routes to test the behavior and it was working fine then. I think they should either:
|
I have the same problem with 4.6.0 version of nebular. <nb-action *ngIf="isLoggedIn">
<nb-user [name]="user?.name" [picture]="'https://www.gravatar.com/avatar/' + user?.email_hash"
[nbContextMenu]="accountMenuActions" nbContextMenuTag="account-menu" nbContextMenuTrigger="hover">
</nb-user>
</nb-action> If i logout and login again i have the same error.
It can aslo appear after navigation on specific routes, always the same routes. |
What @niklasravnsborg suggested worked for me. The |
Whats the fix for this? im having same issue. |
I don't remember exactly but do you use multiple |
I'm also experiencing the exact same behavior, hope there are any updates to this bug |
I have experienced the same error: <nb-action class="user-action" *ngIf="isAuth">
<nb-user
[nbContextMenu]="userMenu"
nbContextMenuTag="user-context-menu"
[name]="user?.email"
[onlyPicture]="userPictureOnly"
[picture]="user?.picture">
</nb-user>
</nb-action> I could not load the My main app component used the <nb-layout>
<nb-layout-header fixed>
<app-header></app-header>
</nb-layout-header>
<nb-layout-column>
<router-outlet></router-outlet>
</nb-layout-column>
<nb-layout-footer fixed>
Footer
</nb-layout-footer>
</nb-layout> During route changes, my <nb-layout>
<nb-layout-column>
<nb-card>
<nb-card-header>
<nav class="navigation">Authentication</nav>
</nb-card-header>
<nb-card-body>
<app-auth-block>
<router-outlet></router-outlet>
</app-auth-block>
</nb-card-body>
</nb-card>
</nb-layout-column>
</nb-layout> The surprising fix was to remove the
Thanks to this trick the error is gone and I can see the context menu while clicking on the user icon. I hope this confirms that the error still exists, even in |
solved adding one space in path definition: |
Issue type
I'm submitting a ... (check one with "x")
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
Angular, Nebular
The text was updated successfully, but these errors were encountered: