Skip to content

feat: migrate MessageSearch to PaginatedVirtualList#2

Open
srijnabhargav wants to merge 7 commits into
feat/tanstack-virtual-pocfrom
feat/tanstack-message-search
Open

feat: migrate MessageSearch to PaginatedVirtualList#2
srijnabhargav wants to merge 7 commits into
feat/tanstack-virtual-pocfrom
feat/tanstack-message-search

Conversation

@srijnabhargav
Copy link
Copy Markdown
Owner

@srijnabhargav srijnabhargav commented Mar 22, 2026

Proposed changes

This PR migrates MessageSearch from react-virtuoso to the shared PaginatedVirtualList component introduced by the Virtua foundation work.

Changes include:

  • Replacing the existing react-virtuoso implementation with PaginatedVirtualList
  • Updating useMessageSearchQuery to useInfiniteQuery with { items, itemCount } for pagination
  • Aligning MessageSearch with the same consumer pattern used in DiscussionsList and ThreadList
  • Removing Virtuoso-specific setup from MessageSearchTab
  • Adding focused Jest coverage for the MessageSearch migration

The goal is to keep MessageSearch consistent with the new virtualization approach while keeping the scope limited to MessageSearch-specific changes.

Issue(s)

Part of the Virtua migration work for the contextual bar lists.

Further comments

This PR should be merged after the Virtua foundation work (PaginatedVirtualList and DiscussionsList migration), #39394, as it reuses the shared virtualization infrastructure introduced there and only contains MessageSearch-specific changes.

Test plan

  • yarn .testunit:jest --testPathPatterns='contextualBar/MessageSearchTab'
  • ESLint on changed MessageSearchTab files
  • yarn typecheck in apps/meteor
  • Manual: search in room contextual bar, scroll/load more, empty state, date dividers

working video (no regressions):

Screen.Recording.2026-03-23.at.12.48.18.AM.mov

Introduces a generic VirtualList component backed by the virtua Virtualizer.
Supports end-reach callbacks (with async lock), configurable overscan, and a
semantic ul/li structure via VirtuaListContainer. Pairs with the existing
CustomVirtuaScrollbars from @rocket.chat/ui-client.
Replaces the Virtuoso + VirtualizedScrollbars + useResizeObserver setup with
the new VirtualList component. The loadMoreItems signature simplifies from
(start, end) to () => void, deferring pagination logic to the data layer.
- New VirtualList.spec.tsx covers end-reach, overscan, and scroll behaviour
  using a mocked Virtualizer handle
- DiscussionsList.spec.tsx updated for the virtua-backed VirtualList (new
  snapshot generated)
- MessageList.spec.tsx: replace require('react') with jest.requireActual to
  silence @typescript-eslint/no-require-imports
@srijnabhargav srijnabhargav force-pushed the feat/tanstack-message-search branch from 70b5698 to 310c396 Compare June 8, 2026 10:16
@srijnabhargav srijnabhargav changed the title feat(tanstack-virtual): migrate MessageSearch to the shared virtual list feat: migrate MessageSearch to PaginatedVirtualList Jun 8, 2026
@srijnabhargav srijnabhargav changed the base branch from feat/tanstack-virtual-foundation to feat/tanstack-virtual-poc June 8, 2026 10:37
@MartinSchoeler MartinSchoeler force-pushed the feat/tanstack-virtual-poc branch from 4ba2638 to 1d06bc4 Compare June 8, 2026 14:29
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.

1 participant