Skip to content

feat(common): add page-size picker to data tables and pager (#4102) - #4725

Open
ghazy2001 wants to merge 2 commits into
umami-software:devfrom
ghazy2001:feat/data-tables-page-size-picker
Open

ghazy2001 wants to merge 2 commits into
umami-software:devfrom
ghazy2001:feat/data-tables-page-size-picker

Conversation

@ghazy2001

@ghazy2001 ghazy2001 commented Nov 1, 2026 •

Copy link
Copy Markdown

Description

This PR implements a page-size picker across Umami's data tables and pager component, resolving part of #4102 and addressing the maintainer suggestion from PR #4118 ("a page-size picker would be welcome as a smaller PR on top of that").

Changes

  • Constants: Added PAGE_SIZE_OPTIONS = [10, 20, 50, 100] in src/lib/constants.ts.
  • Localization: Added rows-per-page ("Rows per page") in public/intl/messages/en-US.json and registered rowsPerPage in src/components/messages.ts.
  • Pager: Added optional onPageSizeChange and pageSizeOptions props. When provided, renders a clean <Select> dropdown next to page navigation while ensuring non-standard existing page sizes remain selectable.
  • DataGrid: Enabled allowPageSize by default, updating router query params (page: 1, pageSize) upon selection.
  • usePagedQuery: Added pageSize to query key and query parameters so queries properly re-fetch when page size changes.
  • Unit Tests: Added test coverage in:
    • src/components/common/Pager.test.tsx (8 tests covering rendering, page size changes, edge cases, and disabled states).
    • src/components/hooks/usePagedQuery.test.ts (2 tests verifying pageSize propagation to TanStack Query).

Verification

  • pnpm exec biome check: Passed with 0 errors.
  • pnpm exec vitest run src/components/common/Pager.test.tsx src/components/hooks/usePagedQuery.test.ts: 10/10 passed.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@vercel

vercel Bot commented Nov 1, 2026

Copy link
Copy Markdown

@ghazy2001 is attempting to deploy a commit to the Umami Software Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps

greptile-apps Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[High impact] The PR appears safe to merge; all four previous findings are addressed.

Summary

Adds a page-size picker to data tables and passes the selected size through paged queries.

  • Paged tables let people choose how many rows they see.
  • Generated telemetry request types include optional salt fields.

All four previous findings are addressed. No new actionable issues were established. Tests and browser checks were not run.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A["User selects a page size"] --> B["DataGrid updates pageSize and resets page"]
  B --> C["Query hook reads URL values"]
  C --> D["API returns the requested rows"]
  D --> E["Pager shows the returned page size"]
Loading

Reviews (2) · Last reviewed commit: "fix(common): address review feedback on ..." · Reviewed by Greptile

Comment thread src/components/common/DataGrid.tsx Resolved
Comment thread public/intl/messages/en-US.json Resolved
Comment thread src/components/common/Pager.tsx Resolved
Comment thread src/components/common/Pager.test.tsx Resolved
@ghazy2001
ghazy2001 force-pushed the feat/data-tables-page-size-picker branch from 41007e3 to efb506d Compare November 1, 2026 17:48
@ghazy2001
ghazy2001 force-pushed the feat/data-tables-page-size-picker branch from efb506d to a44c6fa Compare November 1, 2026 17:53
@ghazy2001

Copy link
Copy Markdown
Author

@greptile review

Addressed all 4 review findings:

  • Connected pageSize in useErrorFilters to query.pageSize with bounds check [1, 100] and default fallback 25.
  • Added 'rows-per-page' English fallback to useLocale.ts.
  • Added accessible �ria-label and riggerProps to Select in Pager.tsx.
  • Added unit test in Pager.test.tsx verifying page size change interaction and callback.

This branch has not been deployed

No deployments
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