Skip to content

fix(Pagination): make onPageChange optional in wrapper component types#25

Merged
garrity-miepub merged 1 commit intomainfrom
bugfix/pagination-bug
Jan 28, 2026
Merged

fix(Pagination): make onPageChange optional in wrapper component types#25
garrity-miepub merged 1 commit intomainfrom
bugfix/pagination-bug

Conversation

@garrity-miepub
Copy link
Copy Markdown
Contributor

The PaginationWithState and SimplePaginationWithState wrapper components manage their own internal page state and provide onPageChange to the underlying Pagination component. However, the wrapper's props type was using React.ComponentProps directly, which includes onPageChange as a required prop.

This caused TypeScript errors in the showcase stories (AllVariants, AllSizes) where the wrapper is used without passing onPageChange, since the wrapper handles it internally.

Fix: Change the wrapper props type to:
Omit<React.ComponentProps, 'onPageChange'> & {
onPageChange?: (page: number) => void;
}

This makes onPageChange optional for callers while still allowing them to pass a callback if they want to be notified of page changes.

The PaginationWithState and SimplePaginationWithState wrapper components
manage their own internal page state and provide onPageChange to the
underlying Pagination component. However, the wrapper's props type was
using React.ComponentProps<typeof Pagination> directly, which includes
onPageChange as a required prop.

This caused TypeScript errors in the showcase stories (AllVariants,
AllSizes) where the wrapper is used without passing onPageChange,
since the wrapper handles it internally.

Fix: Change the wrapper props type to:
  Omit<React.ComponentProps<typeof Pagination>, 'onPageChange'> & {
    onPageChange?: (page: number) => void;
  }

This makes onPageChange optional for callers while still allowing them
to pass a callback if they want to be notified of page changes.
@garrity-miepub garrity-miepub marked this pull request as ready for review January 28, 2026 23:49
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying ui with  Cloudflare Pages  Cloudflare Pages

Latest commit: b2cfc3e
Status: ✅  Deploy successful!
Preview URL: https://f3415cc9.ui-6d0.pages.dev
Branch Preview URL: https://bugfix-pagination-bug.ui-6d0.pages.dev

View logs

@garrity-miepub garrity-miepub merged commit fb9d741 into main Jan 28, 2026
2 of 7 checks passed
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