Skip to content
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

close() should not trigger openChange, if invoked from ngOnDestroy #4689

Open
alexandis opened this issue Apr 7, 2024 · 0 comments
Open

Comments

@alexandis
Copy link

alexandis commented Apr 7, 2024

I am trying to reopen the menu which resides in a row of re-rendered grid. I use openChange event handler to keep track of row ID:

onContextMenuOpenChange(isOpen: boolean, row: MyData) {
    this.openedContextMenu = isOpen ? row.id : null;  
}

I could not make it work, because even though I did not change the menu visibility to false anywhere, it was somehow reset to false after reopening (and openChange handler does "explain" why - it just provides "true" or "false"). I later took a look and found out this:

close() {
    if (this._open) {
        this._open = false;
        this._resetContainer();
        this._positioning.destroy();
        this._zoneSubscription?.unsubscribe();
        this._destroyCloseHandlers$.next();
        this.openChange.emit(false); // it should not be invoked, if it called from ngOnDestroy
        this._changeDetector.markForCheck();
    }
}

ngOnDestroy() {
    this.close();
} 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant