Skip to content

OnItemClick stored in ReplaySubject cause logout right after login  #695

Description

@thomas-tewelde

Issue type

I'm submitting a ... (check one with "x")

  • bug report
  • feature request

Issue description

Current behavior:
@nnixaa I am subscribing to onItemClick then logout from the logout menu item is selected.

this.menuService.onItemClick()
    .pipe(takeUntil(this.ngUnsubscribe))
    .subscribe(item => {
      if (item.item.title === this.logoutMenuItem.title) {
        this.logout();
      }
    });

it successfully logs but on login again the onItemClick is triggered therefore logs out
user immediately. That's because from the code the clicked items are stored in ReplaySubject

const itemClick$ = new ReplaySubject<NbMenuBag>(1);

Expected behavior:
i want on logout the ReplaySubject cache to be cleared out.

Steps to reproduce:
May be add an option to pass a null value as the last clicked item, so that the user has
an option to pass null menu item. so when the subscription picks up the replay it won't do anything.

Related code:

Other information:

Angular, Nebular

    "@nebular/theme": "^2.0.0-rc.9"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions