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

getChannels and ircClient.channels lists redundant entries upon multiple join calls #130

Open
itsatony opened this issue May 6, 2016 · 6 comments
Milestone

Comments

@itsatony
Copy link

itsatony commented May 6, 2016

Actual behaviour:
the .channels array of the ircClient lists non-unique entries.
apparently, sending multiple joins for the same channel-name leads to multiple entries in the array.

Expected behaviour:
a list of unique, actually joined, channels.

Error log:

Insert your error log here

Server configuration

  • Operating system:
    ubuntu 14.04 lts
  • Node version (if applicable):
    4.4.3
  • NPM version (if applicable):
    2.15.1
  • tmi.js version:
    0.0.29
@Schmoopiie
Copy link
Member

@itsatony, I'm trying to reproduce this issue right now and I can't replicate it. Are you using client.getChannels() to get the current channels ?

If you could post your code that is causing this issue it would be very helpful.

Thank you!

@Schmoopiie
Copy link
Member

I will close this issue, feel free to comment here if you are still experiencing this issue.

@itsatony
Copy link
Author

sorry, forgot to answer.
so ..


client.join('#test');
-> Promise { <pending> }
client.getChannels();
-> [ '#test' ]
// ...(later)...
client.join('#test');
-> Promise { <pending> }
client.getChannels();
-> [ '#test', '#test' ]

this can be repeated endlessly... then, when parting the channel, it's still in the list.. multiple times potentially.

also, upon disconnect the channels array still has all channels listed.

my basic problem is, that the channels list feels like a list of join+part commands rather than a list of channels that the client is actually in.

@itsatony
Copy link
Author

btw.. it seems like a weird approach, but what i basically do to at least guarantee the uniqueness of the array is this:

ircClient.channels = [ ...new Set(ircClient.channels) ];

@Schmoopiie
Copy link
Member

Thanks I will try to replicate this, if you have something like a simple script to replicate it I would really appreciate it. Not gonna lie, I'm a bit busy lately, so it might take some time.

I don't use Set, Map, WeakMap, etc.. in this module because I don't want to have to use a ton of polyfills.. as far as I know these are not compatible with IE and Safari

Reopening your issue 😄

@Schmoopiie Schmoopiie reopened this Jul 24, 2016
@AlcaDesign
Copy link
Member

@Schmoopiie Schmoopiie added this to the 2.0.0 milestone Apr 15, 2017
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

3 participants