Skip to content

Conversation

@viktormarinho
Copy link
Contributor

@viktormarinho viktormarinho commented Jan 5, 2026

Summary

Fixes the monitoring scroll issue where logs were being replaced instead of accumulated when scrolling to the bottom.

Problem

The monitoring logs table was using URL-based pagination that replaced all logs with the next page's logs when scrolling to the bottom. Users expected infinite scroll behavior where new logs append to existing ones.

Solution

  • Replaced manual state management with useSuspenseInfiniteQuery from React Query
  • React Query now handles all log accumulation automatically via data.pages
  • Added isLoading guard to useInfiniteScroll hook to prevent duplicate triggers
  • Memoized ref callback with useCallback to prevent unnecessary IntersectionObserver recreation
  • Removed page parameter from URL (pagination now handled internally)

Changes

  • apps/mesh/src/web/routes/orgs/monitoring.tsx - Use useSuspenseInfiniteQuery for proper infinite scroll
  • apps/mesh/src/web/hooks/use-infinite-scroll.ts - Add isLoading param and memoize callback

Testing

  • Navigate to monitoring page with 50+ logs
  • Scroll to bottom → logs should append (not replace)
  • Change a filter → logs should reset to fresh first page
  • Streaming mode still works for live updates

Summary by cubic

Implemented true infinite scroll in Monitoring so logs append as you reach the bottom instead of replacing the list. This replaces URL-based pagination with React Query infinite queries and keeps streaming mode working.

  • Bug Fixes
    • Accumulate logs via data.pages and flatten for the table and stats (using server total when available).
    • Added isLoading guard in useInfiniteScroll to prevent duplicate triggers and avoid observer churn.
    • Removed page from the URL; pagination is handled internally with fetchNextPage and hasNextPage.

Written for commit 43095b4. Summary will update on new commits.

- Replace URL-based pagination with useSuspenseInfiniteQuery from React Query
- Logs now properly accumulate when scrolling (append behavior vs replace)
- Add isLoading guard to useInfiniteScroll hook to prevent duplicate triggers
- Memoize ref callback with useCallback to prevent unnecessary observer recreation
- Remove page parameter from URL (pagination handled internally by React Query)

Fixes scroll issues where logs were replaced instead of appended when
reaching the bottom of the monitoring table.
@github-actions
Copy link
Contributor

github-actions bot commented Jan 5, 2026

🧪 Benchmark

Should we run the MCP Gateway benchmark for this PR?

React with 👍 to run the benchmark.

Reaction Action
👍 Run quick benchmark (10 & 128 tools)

Benchmark will run on the next push after you react.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 5, 2026

Release Options

Should a new version be published when this PR is merged?

React with an emoji to vote on the release type:

Reaction Type Next Version
👍 Prerelease 1.0.19-alpha.1
🎉 Patch 1.0.19
❤️ Minor 1.1.0
🚀 Major 2.0.0

Current version: 1.0.18

Deployment

  • Deploy to production (triggers ArgoCD sync after Docker image is published)

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

- Add monitoringLogsInfinite to KEYS for centralized query key management
- Remove useCallback from useInfiniteScroll (React Compiler handles memoization)
@viktormarinho viktormarinho merged commit 1a28ac6 into main Jan 5, 2026
5 checks passed
@viktormarinho viktormarinho deleted the fix/monitoring-infinite-scroll branch January 5, 2026 14:33
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.

2 participants