Repository navigation
feat(Typing): cache member object - #10786
Pavel-Boyazov wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Skipped Deployments
|
| if ('member' in data) { | ||
| /** | ||
| * The member that this guild typing instance represents | ||
| * @type {?GuildMember} | ||
| */ | ||
| this.member = this.channel.guild.members._add(data.member, true); | ||
| } |
There was a problem hiding this comment.
This PR makes the member only set when its provided, otherwise it will be undefined (not null). Either we keep the getter and add the caching logic in too, or we define a fallback that is the getter
There was a problem hiding this comment.
This can be done without getters. If the member property was not set when the object was created, then there can be no conditions when it will be set later (except manually). I can use the ternary operator to set null if there is no data.
What do you think?
There was a problem hiding this comment.
|
#10786 (comment) still stands, this PR is adding nothing, the cache already gets updated and the getter is fine. |
Please describe the changes this PR makes and why it should be merged:
Discord API provides member object with
TYPING_STARTevent in guild. We can use this for cache update and getting value without getterStatus and versioning classification: