-
-
Notifications
You must be signed in to change notification settings - Fork 171
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: improve __jump_to_message
reliability
#4554
Conversation
4832061
to
4701d5d
Compare
e8f3b2e
to
6dddd28
Compare
6dddd28
to
4d7b919
Compare
4d7b919
to
321ef27
Compare
That is, when you jump to a message in a different chat (e.g. by clicking on a notification, or from message search, or from a "private reply" quote), we would momentarily show the new chat scrolled to bottom prior to jumping to the desired message. Why this is bad: - We mark the visible messages as read. In this case that would be the last messages in the chat. But they weren't actually read, the user did not intend to scroll to them. - Extra layout shifting: not great visually. - Bad for performance. Let's just load the part of the chat that we need right away. Related: - #4508 - #4510 - #4554
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.
When reviewing this and the whole "jumpToMessage" logic, it seems we should clarify and/or document what is going on (perhaps improve the comment in jumpToMessage in MessageListStore)
We have now:
a function _window._internal_jump_to_message
another function _window._internal_check_jump_to_message
an object maybeJumpToMessageHack which is assigned to window.__internal_jump_to_message_asap which has a property jumpToMessageArgs which holds a addMessageIdToStack
Maybe a list of use cases would help. Ideally some (for now manual) tests, to make sure changes do not break anything?
321ef27
to
b052640
Compare
OK, I force-pushed the initial commit to clarify those |
dd628c9
to
2b33c44
Compare
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.
Wow! Very accurate documentation! Thanks for that! Will help a lot in future development!
Tested randomly and so far everything worked as expected.
2b33c44
to
8754014
Compare
That is, when you jump to a message in a different chat (e.g. by clicking on a notification, or from message search, or from a "private reply" quote), we would momentarily show the new chat scrolled to bottom prior to jumping to the desired message. Why this is bad: - We mark the visible messages as read. In this case that would be the last messages in the chat. But they weren't actually read, the user did not intend to scroll to them. - Extra layout shifting: not great visually. - Bad for performance. Let's just load the part of the chat that we need right away. Related: - #4508 - #4510 - #4554
That is, when you jump to a message in a different chat (e.g. by clicking on a notification, or from message search, or from a "private reply" quote), we would momentarily show the new chat scrolled to bottom prior to jumping to the desired message. Why this is bad: - We mark the visible messages as read. In this case that would be the last messages in the chat. But they weren't actually read, the user did not intend to scroll to them. - Extra layout shifting: not great visually. - Bad for performance. Let's just load the part of the chat that we need right away. Related: - #4508 - #4510 - #4554
Follow-up to 6a656f9
(#4510).
Partially addresses #4508.
Why partially? Because the bug appears to still happen sometimes.
But this commit should make it more reliable, or at least be a refactor.
This should also improve performance in some cases,
thanks to the removal of
setTimeout()
.