- Remove redundant containerRef (useRef), keep only useState for container
- Rename return value from 'ref' to 'setRef' for clearer API
- Replace waitForTimeout with proper expect().toHaveCount() in E2E tests
Addresses code review feedback on PR #12084
When the conversation panel was closed and reopened, TanStack Query's
useInfiniteQuery would refetch all cached pages, causing multiple API
calls. This fix adds staleTime of 5 minutes to prevent unnecessary
refetches when the data is still fresh.
This is consistent with other hooks in the codebase that use the same
staleTime value.
Co-authored-by: openhands <openhands@all-hands.dev>
- Fix avatar-menu test: Remove group-hover:pointer-events-auto from wrapper
div to prevent menu from intercepting clicks on the avatar button. Only
enable pointer events when menu is actually open via click.
- Fix infinite-scroll test: Add data-testid='conversation-card' to
RecentConversation component for test selector consistency.
- Update recent conversations test: Change test to match actual component
behavior (View More/Less button instead of infinite scroll). The
RecentConversations component uses a display limit with expand/collapse
functionality, not infinite scroll for display.
Co-authored-by: openhands <openhands@all-hands.dev>
- Add infinite-scroll.spec.ts with tests for:
- Loading more conversations when scrolling in conversation panel
- Loading more conversations when scrolling in recent conversations
- Fix avatar-menu.spec.ts:
- Changed test to use click-to-open behavior instead of CSS hover
- CSS hover bridge cannot be reliably tested with Playwright
- Removed browser-specific skips since click behavior works everywhere
Co-authored-by: openhands <openhands@all-hands.dev>
- Generate 50 mock conversations instead of 3 for better pagination testing
- Add pagination support to mock API endpoint
- Include variety of project names, repositories, and statuses
Co-authored-by: openhands <openhands@all-hands.dev>
The useInfiniteScroll hook had a bug where the scroll event listener
might not be attached if the ref was assigned after the initial render.
This happened because the useEffect depended on handleScroll, which
didn't change when the ref was assigned via a callback ref.
Changes:
- Modified useInfiniteScroll to use a callback ref and state to track
when the container is mounted
- The hook now returns { ref, containerRef } instead of just the ref
- Updated ConversationPanel and RecentConversations to use the new API
This ensures that the scroll event listener is properly attached when
the container element is mounted, enabling auto-pagination to work
correctly in the conversations list.
Co-authored-by: openhands <openhands@all-hands.dev>