Skip to content

Conversation

@Pratheek555
Copy link
Contributor

Brief Title

Implement initial scroll-to-message logic for navigating to attachments from the All Files view

Acceptance Criteria fulfillment

  • Clicking a file in the All Files view navigates to the original message
  • The chat scrolls smoothly to the target message

Fixes #1057

Video/Screenshots

EmbeddedChat._.Simple.-.Simple.Storybook.-.Brave.2026-01-07.13-46-01.mp4

PR Test Details

Note: The PR will be ready for live testing at https://rocketchat.github.io/EmbeddedChat/pulls/pr-<pr_number> after approval. Contributors are requested to replace <pr_number> with the actual PR number.

@Spiral-Memory
Copy link
Collaborator

If a file isn’t in the current DOM, how would you navigate to that file attachment? Similar issues, like finding a starred message, often require implementing solutions with tools such as react-virtuoso, tanstack, or similar libraries. It would great for everyone to collaborate on this for a sustainable fix.

Ref: #1059

@Pratheek555
Copy link
Contributor Author

Pratheek555 commented Jan 21, 2026

Hey @Spiral-Memory

I have been looking into using Tanstack query to solve this issue, will be working on a PR towards it. Please do let me know if you wanted anything different.

Thank you!

@Pratheek555
Copy link
Contributor Author

Hey @Spiral-Memory

I have been working on the PR for sometime now and these are the major changes I have made.

# Change - 1:

  • Used Tanstack virtual to virtualize the MessageList component which will also solve our problem of jumping to the messages which are not present in the DOM
Virtualization.of.messages.mp4

# Change - 2

  • Because sometimes the messages to be jumped to are not present in the message store itself, I have implemented a function which loops through the similar logic we used for paginating the messages.
  • It loops through the older messages to find that particular message and updates the message store, this way we can jump to the message which is in store while rendering the messages around it too.
FunctionLoopToLoadMessageStore.mp4
  • here in the above video the pinned message "Yo!" is not present in the messageStore. So we have some backend calls being executed to find if that message.
  • One other problem I faced was pinnedMessageAggregator only showed pinned Messages which were present in the DOM or loaded in the message store. Now I have used the pinMessage endpoint from rocketchat to get all the messages which are pinned

@Pratheek555
Copy link
Contributor Author

Please do let me know if this is what was expected and if there any changes to be made.

As of now this does not go to the pinnedMessages inside a thread. I felt that as these are some fundamental changes once I get your approval of whether this is the right direction to proceed, then I would implement it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable navigation to original message when clicking files in “Files” view

2 participants