-
-
Notifications
You must be signed in to change notification settings - Fork 172
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: "jump down" unread counter not clearing #4648
Conversation
Reproduction steps: 1. Open a chat. 2. Scroll it up. 3. Receive a message or a few in this chat. 4. Scroll down to read all the new messages. The counter will be updating as you read the messages, as expected. 5. Scroll up a bit. The "jump down" button will appear again, but with an incorrect count. The bug was introduced in 1a752fa (#4594). This commit somewhat reverts it, i.e. ensures that `useUnreadCount` does not lose its state when we start / stop displaying the "jump down" button.
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 tested this and the behaviour is the same as in main, so the bug is not fixed.
Is see that onUnreadMessageInView returns immediately if window is in focus? How should the messages ever be marked as read?
Btw. strange that this never was reported so far as bug. It exists at least since 1.52.0. It is pretty obvious that the badge in the chatlist still shows the number of unread messages even if you scroll to the buttom |
It's the opposite deltachat-desktop/packages/frontend/src/components/message/MessageList.tsx Lines 159 to 162 in f1873b5
Does the "Message info" dialog show that the last message is read? |
Argh - ok since I was in the debugger the chat window has no focus anymore. So now I set a debug break point in MessageList.tsx line 198 But that was not triggered when scrolling down and thus the counter doesn't get updated. (even without brek point of course) Interestingly it gets updated as soon as I click somewhere in the chat window or the composer. So maybe when switching to the Deltachat Window and just scroll it does not really focus the chat window? |
screencast6.mp4The interruption was the debugger at markseenMsgs |
Is the window focused in the first half of the video? If not, I'd say it's expected. |
The chat is open and I switched from another app back to deltachat. See there are new messages and scroll down. The jumpDown button disappears but the chat list item still shows the counter and markRead is not triggered. So I scrolled to bottom see all messages but it needs another action to trigger the focus? The scrolling should be enough for triggering. So maybe we need another condition. Is it possible to scroll a window without having focus? |
Yes, e.g. if you have two windows side-by-side.
In this case yeah, sounds like a bug. It's not reproducible on Windows. There it's enough to just Alt + Tab back to the Delta Chat window, then scrolling with the scroll wheel does mark messages as read. Either way, this MR is not relevant to this. |
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.
The observed behaviour was caused by a special case - focus was not triggered in a scrolled window, but the fix solves the bug, that the counter is not correct updated
I meant to say "with the scroll wheel" |
Reproduction steps:
The counter will be updating as you read the messages, as expected.
The "jump down" button will appear again,
but with an incorrect count.
The bug was introduced in 1a752fa
(#4594).
This commit somewhat reverts it, i.e. ensures that
useUnreadCount
does not lose its state when we start / stopdisplaying the "jump down" button.