Skip to content

fix: when scheduling next update in the presence service _presentChannels.length is always undefined #22053

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

Merged
merged 1 commit into from
Jun 12, 2023

Conversation

Mubramaj
Copy link
Contributor

The else if is then never triggered.

I would like to create a test but the else if is also testing !isTesting() so my test wouldn't be meaningful

…nnels.length` is always undefined

The else if is then never triggered.
@@ -606,7 +606,7 @@ export default class PresenceService extends Service {
);
} else if (
!this._nextUpdateTimer &&
this._presentChannels.length > 0 &&
this._presentChannels.size > 0 &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this._presentChannels is a JS Set, so size should always return a value. What makes you say it's 'always undefined'? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that's what I said. .length is always undefined .size works. ( right now in the code it's .length ) I was trying to implement same mechanism and I am using typescript so it complained and I tried it in the console:

image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha I see, I read the diff backwards. Thanks for the fix @Mubramaj 🙌

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My pleasure!

@davidtaylorhq davidtaylorhq merged commit 589add7 into discourse:main Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants