Skip to content
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

We don't scroll to some newly arrived messages #4329

Open
WofWca opened this issue Nov 9, 2024 · 0 comments
Open

We don't scroll to some newly arrived messages #4329

WofWca opened this issue Nov 9, 2024 · 0 comments
Labels
bug Something isn't working polish

Comments

@WofWca
Copy link
Collaborator

WofWca commented Nov 9, 2024

  • Operating System (Linux/Mac/Windows/iOS/Android): All

  • Delta Chat Version: 1.48.0

  • Expected behavior: No matter what message shows up in a chat, we should scroll to it (as long as we're scrolled to the bottom, of course)

  • Actual behavior: The scroll position remains where it was and you have to scroll to the new message

  • Steps to reproduce the problem:

    1. Open a chat with someone
    2. Send a .xdc (webxdc) app.
    3. Open that app and open the dev tools for the app.
    4. Type
      webxdc.sendUpdate({
          payload: null,
          info: 'test',
      }, '')
  • Screenshots:

    2024-11-09-yx3KMpXLVI.mp4
  • Logs:

The above reproduction steps also work for when the info message is triggered by other chat members.

As was discussed in a chat today, some messages do not trigger the IncomingMsg event. Then only trigger MsgsChanged But currently the IncomingMsg event is what we're listening on to scroll to new messages:

onDCEvent(accountId, 'IncomingMsg', ({ chatId: eventChatId }) => {
if (chatId === eventChatId) {
store.effect.onEventIncomingMessage()
} else {
store.log.debug(
`chatId of IncomingMsg event (${chatId}) doesn't match id of selected chat (${eventChatId}). Skipping.`
)
}
}),

static fetchedIncomingMessages(prevState: ChatViewState): ChatViewState {
const {
lastKnownScrollHeight,
// lastKnownScrollTop,
} = getLastKnownScrollPosition()
return {
...prevState,
scrollTo: {
type: 'scrollToBottom',
ifClose: true,
},
lastKnownScrollHeight,
}
}

So, as was suggested by @link2xt and @r10s, we probably need to rewrite the code that updates viewState, to update viewState based on actual changes to the array of messages, and not just events, to catch all such cases.

Related older issues: #1783, #1793,

@WofWca WofWca added bug Something isn't working polish labels Nov 9, 2024
@WofWca WofWca mentioned this issue Nov 13, 2024
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working polish
Projects
None yet
Development

No branches or pull requests

1 participant