-
-
Notifications
You must be signed in to change notification settings - Fork 173
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
perf: improve jumpToMessage
speed
#4584
Conversation
WofWca
commented
Jan 29, 2025
- refactor: remove outdated comment
- refactor: simplify jumpToMessage
- refactor: simplify jumpToMessage again
- perf: improve jumpToMessage speed
8bf2614
to
eb92265
Compare
By removing an unnecessary `await rpc.getMessage()`.
eb92265
to
24f4f32
Compare
// so we know the chatId in advance. | ||
// However, let's keep the code that supports arbitrary chatId, | ||
// which can be "enabled" by setting `chatIdPreset = undefined`. | ||
const chatIdPreset: number | undefined = this.chatId |
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.
You mean that there is (should?) be no use case at the moment, where this.chatId is not set and/or is different from the jumpToMessage.chatId ?
Since later we log an error if isMessageInCurrentChat is false.
If so, you leave the code since it might be useful if we extend the usage later or just as a fallback if this function is called "wrongly" for a message that belongs not to current chat?
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.
You mean that there is (should?) be no use case at the moment, where this.chatId is not set and/or is different from the jumpToMessage.chatId ?
Unless there is a bug that I missed, currently we never call this jumpToMessage
with a msgId that belongs to a chat whose ID is not this.chatId
.
Since later we log an error if isMessageInCurrentChat is false.
Yes, that would be unexpected.
If so, you leave the code since it might be useful if we extend the usage later or just as a fallback if this function is called "wrongly" for a message that belongs not to current chat?
I guess it's for the former case mostly.
But maybe also for the latter, because I am not sure if we'd want to just throw an error instead. In this regard I kept things as they were before me.