rpaschoal / ng-chat

💬 A simple facebook/linkedin lookalike chat module for Angular applications.
MIT License
155 stars 92 forks source link

How to stop the pollFriendsList directive? #120

Closed Nesbox314 closed 4 years ago

Nesbox314 commented 5 years ago

In my API, I can only make requests while logged in, and my question is that the chat continues to try to polling even when logged off, on the login screen, by playing continuous errors. Please HELP!

rpaschoal commented 5 years ago

Hi @Nesbox314 ,

Just add a *ngIf and don't render your chat component if you are not logged in. This should do the trick! 😺

Nesbox314 commented 5 years ago

I gonna try, thanks!

paulStr commented 4 years ago

Hi @Nesbox314 ,

I'm doing just that, not rendering the component using an *ngIf but the polling still happens. I wasn't able to find a way to stop the polling once you start it.

rpaschoal commented 4 years ago

Might be worth while some investigation then. I'm gonna chunk a bug label on this so it can be worked on for a next release @paulStr

rpaschoal commented 4 years ago

Some interesting read on this: https://github.com/angular/angular/issues/23756

I'm going to add an @Input (eg: isDisabled) prop so it can disable the behavior of ng-chat internally nonetheless.

rpaschoal commented 4 years ago

This should now be fixed with version 2.0.5: https://github.com/rpaschoal/ng-chat/releases/tag/2.0.5 👍

You will have to use the isDisabled property to hide ng-chat and that will remove the interval of the friend list poll mechanism.

@paulStr and @Nesbox314 ^