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
fix(Action): Don't crash when partials are disabled #4822
Conversation
src/client/actions/TypingStart.js
Outdated
@@ -7,7 +7,7 @@ const textBasedChannelTypes = ['dm', 'text', 'news']; | |||
class TypingStart extends Action { | |||
handle(data) { | |||
const channel = this.getChannel(data); | |||
if (!textBasedChannelTypes.includes(channel.type)) { | |||
if (channel && !textBasedChannelTypes.includes(channel.type)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we exit early if no channel is present?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Though that way we don't cache any member data anymore if it's there. Depends on if we want to cache everything we possibly can or are more lax.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean... if we don't have the channel but we cache the member...we still don't emit any events, so I believe it's probably best to exit early. That, of course, is open for discussions tho
Please describe the changes this PR makes and why it should be merged:
Fixes #4821
this.getMember() returns undefined if there is no cached member and partials are disabled for members.
Also only checks for the correct channel type in TypingStart if there actually is a known channel, I've missed this in my previous PR.
Status
Semantic versioning classification: