|
| 1 | +--- |
| 2 | +icon: versions-24 |
| 3 | +--- |
| 4 | + |
| 5 | +# CHANGELOG |
| 6 | + |
| 7 | +## Release Policy |
| 8 | + |
| 9 | +Pagy follows the [Semantic Versioning 2.0.0](https://semver.org/), and introduces BREAKING CHANGES only for MAYOR versions. |
| 10 | + |
| 11 | +We release any new version (MAJOR, MINOR, PATCH) as soon as it is ready for release, regardless of any time constraint, frequency |
| 12 | +or duration. |
| 13 | + |
| 14 | +We rarely deprecate elements (releasing a new MAYOR version is just simpler and more efficient). However, when we do, you can |
| 15 | +expect the old/deprecated functionality to be supported ONLY during the current MAYOR version. |
| 16 | + |
| 17 | +## Recommended Version Constraint |
| 18 | + |
| 19 | +Given a version number `MAJOR.MINOR.PATCH` (e.g. `10.0.0`): |
| 20 | + |
| 21 | +The `gem 'pagy', '~> 10.0'` Gemfile entry (without the PATCH number) ensures that the `bundle update` command will update pagy to |
| 22 | +the most recent version WITHOUT BREAKING CHANGES. |
| 23 | + |
| 24 | +Increment the MAYOR version in your Gemfile ONLY when you are ready to handle the BREAKING CHANGES. |
| 25 | + |
| 26 | +## Breaking Changes |
| 27 | + |
| 28 | +If you upgrade from version `< 10.0.0` see the following: |
| 29 | + |
| 30 | +- [Breaking changes in version 10.0.0](#version-1000) |
| 31 | +- [Breaking changes in version 9.0.0](CHANGELOG_LEGACY.md#version-900) |
| 32 | +- [Breaking changes in version 8.0.0](CHANGELOG_LEGACY.md#version-800) |
| 33 | +- [Breaking changes in version 7.0.0](CHANGELOG_LEGACY.md#version-700) |
| 34 | +- [Breaking changes in version 6.0.0](CHANGELOG_LEGACY.md#version-600) |
| 35 | +- [Breaking changes in version 5.0.0](CHANGELOG_LEGACY.md#version-500) |
| 36 | +- [Breaking changes in version 4.0.0](CHANGELOG_LEGACY.md#version-400) |
| 37 | +- [Breaking changes in version 3.0.0](CHANGELOG_LEGACY.md#version-300) |
| 38 | +- [Breaking changes in version 2.0.0](CHANGELOG_LEGACY.md#version-200) |
| 39 | +- [Breaking changes in version 1.0.0](CHANGELOG_LEGACY.md#version-100) |
| 40 | + |
| 41 | +## Deprecations |
| 42 | + |
| 43 | +None |
| 44 | + |
| 45 | +<hr> |
| 46 | + |
| 47 | +## Version 10.0.0 |
| 48 | + |
| 49 | +### Overview |
| 50 | + |
| 51 | +This is a mayor, MAYOR version, with important additions and improvements, a lot easier to use and customize, it has fewer methods |
| 52 | +and variables, cleaner code with a brand-new documentation and the new `Pagy AI`, ready to answer your questions. |
| 53 | + |
| 54 | +### Keynav Pagination Addition |
| 55 | + |
| 56 | +The pagy exclusive technique to use `keyset pagination with numeric pages, supporting `pagy_*navs` and other Frontend |
| 57 | +helpers.<br/>The best technique for performance AND functionality! |
| 58 | + |
| 59 | +### Improvements |
| 60 | + |
| 61 | +- Automatic loading of just the code that you actually use |
| 62 | + : Every class, module and helper is automatically loaded only if you actually use it, without any explicit `require`. |
| 63 | + _(the legacy version was requiring more code)_ |
| 64 | + |
| 65 | +- Better file and namespace system organization |
| 66 | + : The class hierarchy, the mixin files, and the test file structure have been deeply reorganized. |
| 67 | + : The code is cleaner, more concise and more readable, adding fewer modules in the `ancestors` array of yur app. |
| 68 | + |
| 69 | +- The extras are almost all gone |
| 70 | + : They have been converted to autoloaded mixins, or integrated in the core code at zero-cost. You can use the methods that you |
| 71 | + need, and they will just work without explicit requiring. |
| 72 | + : The only extras that are left _(for different compelling reasons)_ are: `gearbox`, `i18n` and `size`. They must be required in |
| 73 | + the initializer as usual. |
| 74 | + |
| 75 | +- The Pagy::Countless remembers the last page |
| 76 | + : When you jump back in the page nav, it remembers the current page count, so you can jump forward. |
| 77 | + |
| 78 | +- Cleaner URLs |
| 79 | + : No more empty params or extra '?' in the url string |
| 80 | + : URL templates are safer for string manipulation. |
| 81 | + : The `pagy_page_url` (legacy `pagy_url_for`) can be used also without a request (incorporating the legacy `standalone` extra) |
| 82 | + |
| 83 | +- Javascript refactoring |
| 84 | + : Updated the support for the pagy helpers and keynav pagination. |
| 85 | + : Added the plain `pagy.js` and relative source map. |
| 86 | + |
| 87 | +### Breaking Changes |
| 88 | + |
| 89 | +#### Core Changes |
| 90 | + |
| 91 | +- The `Pagy::DEFAULT` is now frozen. |
| 92 | + : Remove all the `Pagy::DEFAULT` variables from your code and pass their variables to the constructor. As an alternative to |
| 93 | + avoid repetitions, define your own `PAGY_DEFAULT = {...}` hash and pass it to the different constructors: |
| 94 | + `pagy_offset(scope, **PAGY_DEFAULT, ...)` |
| 95 | + |
| 96 | +- Direct instantiation of the pagy constructor classes is not recommended. |
| 97 | + : Use the provided constructor helpers for easier usage, maintenance and forward compatibility. |
| 98 | + |
| 99 | +- Replace the existing (if any) `Pagy.root` with `Pagy::ROOT` |
| 100 | +- When the `:params` variable is set to a lambda, it should modify the passed `query_params` directly. The returned value is now |
| 101 | + ignored for a sligtly better performance. |
| 102 | + |
| 103 | +#### Simple renaming (without logic changes) |
| 104 | + |
| 105 | +| Type | Search | Replace | Notes | |
| 106 | +|-------------|----------------|-----------------|----------------------------------------------------------| |
| 107 | +| Constructor | `pagy(` | `pagy_offset(` | For consistency with the other old and new constructors | |
| 108 | +| Method | `pagy_url_for` | `pagy_page_url` | The legacy naming was causing rails-related expectations | |
| 109 | + |
| 110 | +#### Extras Replacement |
| 111 | + |
| 112 | +##### `arel`, `array`, `boostrap`, `bulma`, `calendar`, `countless`, `headers`, `keyset`, `pagy` |
| 113 | + |
| 114 | +- Just remove the `require 'pagy/extras/<extra-name>'` from the initializer, and continue to use their features without changes. |
| 115 | + |
| 116 | +##### `elasticsearch_rails`, `meilisearch`, `searchkick` |
| 117 | + |
| 118 | +- Remove the `require 'pagy/extras/<extra-name>'` from the initializer |
| 119 | +- Replace your existing (if any) `Pagy.new_from_<extra-name>` with `pagy_<extra-name>`. _(Active and passive modes are now handled |
| 120 | + by the same helper.)_ |
| 121 | +- Replace the existing (if any) `extend Pagy::Search` statement in your models with `extend Pagy::Offset::Search`. |
| 122 | +- The `pagy_search` name customization has been discontinued. Remove the existing (if any) `:<extra-name>_pagy_search` |
| 123 | + variable from your code, and use the standard `pagy_search` method. |
| 124 | +- Rename the existing (if any) `:<extra-name>_search` variable as `:search_method` and pass it to the constructor. |
| 125 | + |
| 126 | +##### `jsonapi` |
| 127 | + |
| 128 | +- Remove the `require 'pagy/extras/jsonapi'` from the initializer. |
| 129 | +- Rename `pagy_jsonapi_links` as `pagy_links`. Notice that the `nil` links are now removed as the `JSON:API` |
| 130 | + requires. |
| 131 | +- You should pass the `:jsonapi` variable to the constructor when you want to trigger the feature. |
| 132 | + |
| 133 | +##### `limit` |
| 134 | + |
| 135 | +- Remove the `require 'pagy/extras/limit'` from the initializer. |
| 136 | +- You should pass the `:maxable_limit` variable - set to the max limit allowed - to the constructor when you want to trigger the |
| 137 | + feature. |
| 138 | + |
| 139 | +##### `metadata` |
| 140 | + |
| 141 | +- Remove the `require 'pagy/extras/metadata'` from the initializer. |
| 142 | +- Rename the existing (if any) `:scaffold_url` to `url_template` |
| 143 | + |
| 144 | +##### `overflow` |
| 145 | + |
| 146 | +- Remove the `require 'pagy/extras/overflow'` from the initializer. |
| 147 | +- You should pass the `:overflow: ...` variable to the constructor when you want to trigger the feature. |
| 148 | + |
| 149 | +#### `standlone` |
| 150 | + |
| 151 | +- Remove the `require 'pagy/extras/standalone'` from the initializer. |
| 152 | +- Replace the `:url` variable with `:request`, and its content with `{ url_prefix: 'the-previous-value-of-url' }`. You can also |
| 153 | + optionally add your `query_params` hash. For example `{ query_params: { param1: 'abc', param2: 'def' }` for complete control |
| 154 | + over the generated url. |
| 155 | + |
| 156 | +##### `trim` (discontinued) |
| 157 | + |
| 158 | +- It was mostly useless and half backed, causing a lot of complications in the ruby and javascript code. |
| 159 | +- Use a proper way to address your requirement, like using URL rewriting at the HTTP server level. |
| 160 | + |
| 161 | +##### `gearbox` |
| 162 | + |
| 163 | +- Remove the `:gearbox_extra` variable from your code |
| 164 | +- You should pass the `gearbox_limit: [...]` variable to the constructor when you want to trigger the feature. |
| 165 | + |
| 166 | +##### `i18n`, `size` |
| 167 | + |
| 168 | +- No change required. |
| 169 | + |
| 170 | +#### Possibly Breaking Overridings |
| 171 | + |
| 172 | +- The internal Pagy protected methods have been renamed and refactored. If you use custom Pagy classes, you may need to search |
| 173 | + into the code. |
| 174 | + |
| 175 | +[LEGACY CHANGELOG >>>](CHANGELOG_LEGACY.md) |
0 commit comments