Skip to content

Query Fan-out: High frequency pager renders every page number and overflows the row #446

Closed

Description

@gkhngyk

Problem

The High frequency view of the Query Fan-out tab renders one pagination button per page, for every page. With PAGE_SIZE = 10, a brand with a few thousand observed sub-queries gets hundreds of number buttons in a single non-wrapping flex row — the pager spans the full card width, buttons get squeezed, and some page numbers (e.g. "2") are pushed out of view entirely.

Where (verified in code)

HighFrequencyView in web/src/app/[locale]/(dashboard)/dashboard/prompts/_fanout-tab.tsx:

{totalPages > 1 && (
  <div className="flex items-center justify-center gap-1 pt-4">
    {Array.from({ length: totalPages }, (_, i) => {
      ...

Fix

Replace the full enumeration with a windowed pager with ellipsis: always show the first and last page, the current page ± 1 neighbor, and … separators for the gaps — e.g.

‹  1 … 4 [5] 6 … 500  ›

Details:

  • Add Previous/Next chevron buttons at the ends (disabled on the first/last page).
  • A small pure helper that maps (page, totalPages) to something like [1, '…', 4, 5, 6, '…', 500] is enough — no library needed. Render … as a non-interactive muted span.
  • When totalPages is small (≤ 7 or so), just show all numbers — no ellipsis.
  • Keep the existing button styling (h-7 w-7 p-0 text-xs, default variant for the current page, ghost for the rest).

For reference, the Citations page solves the same problem with a plain Previous / X / Y / Next pager (TablePager in web/src/app/[locale]/(dashboard)/dashboard/citations/page.tsx) — but here we want to keep direct page-number navigation, hence the windowed style.

Acceptance criteria

  • With many pages (e.g. 500), the pager renders at most ~9 elements: ‹ 1 … n-1 n n+1 … last › — it never overflows or wraps.
  • The current page is always visible and highlighted; first/last pages are always one click away.
  • Clicking a number, Previous, or Next changes the page exactly as before.
  • With few pages (e.g. 3), all numbers show and there is no ellipsis.

Getting started

See CONTRIBUTING.md for setup. From web/, yarn lint, yarn typecheck and yarn format:check must pass. Note that #445 touches the same file (default view change) — the changes don't overlap, but rebase if it lands first. Comment here to claim the issue before opening a PR.

Activity

  1. added
    bug
    good first issue
    on Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions