Skip to content

pagination-plugin and fetch options on count fix#1914

Merged
ricardograca merged 2 commits intobookshelf:masterfrom
throrin19:patch-pagination-plugin
Dec 1, 2018
Merged

pagination-plugin and fetch options on count fix#1914
ricardograca merged 2 commits intobookshelf:masterfrom
throrin19:patch-pagination-plugin

Conversation

@throrin19
Copy link
Contributor

Introduction

Make the pagination plugin fully compatible with others bookshelf plugins

Motivation

In my project, I use the plugin bookshelf-paranoia to use the soft delete feature. I have a problem with pagination.

If I want to show soft deleted items using pagination, the fetchPaginate function return correctly the models but don't return correct count.

After resarch, it appears the count part don't use passed fetch options except the transacting parameter.

Proposed solution

I propose to use others fetch options on count part omit all default fetch params (withRelated, ...) to avoid problems

@throrin19 throrin19 changed the title fix #1913 pagination-plugin and fetch options on count fix Nov 13, 2018
Copy link
Member

@ricardograca ricardograca left a comment

Choose a reason for hiding this comment

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

This looks good, but it needs tests to verify the correct behavior of the fix and to ensure it doesn't get re-introduced in the future.

@throrin19
Copy link
Contributor Author

I hope I make correct tests, I try if the count lost standard options and keep custom options

@ricardograca
Copy link
Member

Nice work! I'll review this properly soon.

Copy link
Member

@ricardograca ricardograca left a comment

Choose a reason for hiding this comment

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

Looks good to me and all tests pass.

@throrin19
Copy link
Contributor Author

Great !! Have you a release date for this PR integration in bookshelf ? I realy need this in my current development

@ricardograca
Copy link
Member

I will most likely make it to the next version (0.14.0) which will be released soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants