Add option to configure the cursor/param name #53
+111
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request adds the ability to customize the cursor query parameter name.
Changes
The
cursor_name
configuration option can now be set to a custom value in theGearedPagination.configure
block. By default, the cursor parameter is named:page
, but it can now be customized.The reason for this change is to provide more flexibility for developers who may want to use a different query parameter name for pagination cursors, for example to avoid conflicts with other query parameters in their application or where the FE expects a specific name for the cursor param.
Usage
You can also use the cursor parameter name in your links to generate pagination URLs:
This will generate a URL with a
?cursor=<next_cursor>
query parameter instead of?page=<next_page>
.Additional Notes
This pull request includes tests to ensure that the
cursor_name
option is working as expected, and that links with custom cursor parameter names are generated correctly.