Skip to content

Conversation

@koppen
Copy link
Member

@koppen koppen commented Oct 24, 2025

This is a vendorization of the pagy gem version 43.0.0.rc1 - the best pagination gem out there.

pagy is MIT licensed, see https://github.com/ddnexus/pagy/blob/d70e443872a5b18da4e482454b3c8b4a1c86cb6b/LICENSE.txt.

Vendoring it allows us to avoid a dependency, and also lets us move it under the Uchi namespace, so we can be included into projects that already depend on pagy without causing conflicts.

It also allows us to pare down the pagy gem to just the bits that we need and use. Since we rely on the :offset paginator only, so we can remove the other paginators and the optimist dependency.

The offset paginator works out of the box with Rails, ActiveRecord and has UI support without the need for Javascript or clientside storage. That makes it the best fit for our needs where we need to integrate into various applications with minimal dependencies and assumptions.

We also don't need their helper methods for generating Bulma/Bootstrap HTML as we have our own rendering for that.

Copilot AI review requested due to automatic review settings October 24, 2025 14:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR vendors the pagy gem (version 43.0.0.rc1) directly into the codebase to eliminate the external dependency, avoid namespace conflicts, and reduce unnecessary functionality. The vendored code includes only the offset paginator implementation, excluding other paginators and UI helpers that aren't needed.

Key changes:

  • Removed pagy gem dependency from gemspec
  • Added vendored pagy source code under lib/pagy/ with core pagination functionality
  • Excluded vendored pagy code from linting standards

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
uchi.gemspec Removed pagy gem dependency
lib/pagy/toolbox/paginators/offset.rb Core offset pagination implementation
lib/pagy/toolbox/paginators/method.rb Pagy method definition and autoloading
lib/pagy/toolbox/helpers/page_url.rb Page URL generation helper
lib/pagy/toolbox/helpers/loader.rb Dynamic helper method loading
lib/pagy/modules/console.rb Console/IRB support utilities
lib/pagy/modules/abilities/shiftable.rb Previous/next page navigation
lib/pagy/modules/abilities/rangeable.rb Range validation and error handling
lib/pagy/modules/abilities/linkable.rb URL composition and query building
lib/pagy/modules/abilities/configurable.rb Configuration methods for JavaScript sync and i18n
lib/pagy/classes/request.rb Request abstraction for page/limit resolution
lib/pagy/classes/offset/offset.rb Main offset pagination class
lib/pagy/classes/exceptions.rb Custom exception definitions
lib/pagy.rb Top-level Pagy class with autoloading
.standard.yml Excluded vendored pagy code from linting

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

This is a vendorization of the pagy gem version 43.0.0.rc1 - the best
pagination gem out there.

pagy is MIT licensed, see
https://github.com/ddnexus/pagy/blob/d70e443872a5b18da4e482454b3c8b4a1c86cb6b/LICENSE.txt.

Vendoring it allows us to avoid a dependency, and also lets us move it
under the Uchi namespace, so we can be included into projects that
already depend on pagy without causing conflicts.
We rely on the :offset paginator only, so we can remove the other
paginators and the optimist dependency.

The offset paginator works out of the box with Rails, ActiveRecord and
has UI support without the need for Javascript or clientside storage.
That makes it the best fit for our needs where we need to integrate into
various applications with minimal dependencies and assumptions.

We also don't need their helper methods for generating
Bulma/Bootstrap HTML as we have our own rendering for that.
@koppen koppen merged commit 5cad89c into main Oct 24, 2025
3 checks passed
@koppen koppen deleted the vendor_pagy branch October 24, 2025 14:55
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